This should be real easy. Given below is the HTML.
#Attachment#
Since your text happens to be the first child node of the The To retrieve the value of all text children (or a specific one), just loop over the var firstChild = $("#attachmentContainer")[0].firstChild;
var textValue = firstChild.nodeType == 3 ? $.trim(firstChild.nodeValue) : "";
nodeType
check is meant to be a safeguard - it makes sure you are actually handling a text node - the firstChild
might be something different after all. React accordingly, this is just an example.childNodes
collection of your element, concatenating all bits you find into a string:// the optional "at" parameter lets you define which text node you want
// if not given, this returns all text nodes concatenated
$.fn.ownText = function(at) {
var result = [], node = this[0];
if (!(node && node.childNodes)) return;
for (var i=0; i