getting the first line of text in an element jquery

Use the contents()[docs] method to get all children, including text nodes, filter out any empty (or whitespace only) nodes, then grab the first of the set.

var first_line = $("#element")
                       .contents()
                       .filter(function() { 
                           return !!$.trim( this.innerHTML || this.data ); 
                       })
                       .first();

text node: http://jsfiddle.net/Yftnh/

element: http://jsfiddle.net/Yftnh/1/


Here is idea for you. Of course if there is h4 element before line you want to get:

var content = $('#element').html();
var arr = content.split('<h4>');
console.log(arr[0]);