this will work for you
$('#d1')
.contents()
.filter(function() {
return this.nodeType == Node.TEXT_NODE;
}).text()
or you can use this as suggested below for old browser support also
var text = $("#d1").contents().filter( function() {
return this.nodeType === 3;
}).text();
Demo