JQuery traverse DOM and extract node value
- by Alex
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...