How to get the text of a div which is not a part of any other container in JQuery?

Posted by Raja on Stack Overflow See other posts from Stack Overflow or by Raja
Published on 2010-05-05T18:43:04Z Indexed on 2010/05/05 18:58 UTC
Read the original article Hit count: 199

Filed under:
|

This should be real easy. Given below is the HTML.

<div id='attachmentContainer'>
    #Attachment#
    <span id='spnAttachmentName' class='hidden'>#AttachmentName#</span>
    <span id='spnAttachmentPath' class='hidden'>#AttachmentPath#</span>
</div>  

I want to get just the #Attachment# and not the other text. When I tried

$("#attachmentContainer").text() 

it gives out all #Attachment#, #AttachmentName# as well as #AttachmentPath#. I know I could just put #Attachment# into another span and access it directly but I was just intrigued on how to do this. Any help is much appreciated.

© Stack Overflow or respective owner

Related posts about jquery-selectors

Related posts about jQuery