JQuery traverse DOM and extract node value

Posted by Alex on Stack Overflow See other posts from Stack Overflow or by Alex
Published on 2010-03-25T15:10:57Z Indexed on 2010/03/25 15:13 UTC
Read the original article Hit count: 463

Filed under:
|
|

I have the following DOM:

<div class="qtip qtip-light qtip-active">
   <div class="qtip-wrapper">
      <div class="qtip-borderTop"></div>
      <div class="qtip-contentWrapper">
         <div class="qtip-title">
            <div class="qtip-button"></div>
            **Text I need to extract**
         </div>
         <div class="qtip-content">
            <div class="tooltip">
                <div class="button-container">
                    <script type="text/javascript">
            var link = null;
            var link = $('.qtip-active > .qtip-title').val();
            $('.qtip-active > #button-container').append('<a href=\"mailto:' + link + '\">' + link + '</a>');
                </script>
                </div>
            </div>
         </div>
      </div>
      <div class="qtip-borderBottom"></div>
   </div>
</div>

But the variable link is always undefined when I would expect it to return the text the node specified. I've been reading the jquery documentation for a few hours but I must be missing something with my logic (or lack there of).

Any help appreciated...

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about dom