Thursday, April 19, 2012

Grab Text-Node after find()-usage

I am using JQuery to show a tooltip-Box after clicking an image. So far, I can select the correct div(s) and then I can identify the correct sub-div which contains the text-node as well. Unfortunately I am not able to get the text node of the sub-div. What is wrong - I am getting 'null' after calling html() on currentDescriptionContainer? Thanks in advance!



var tooltipItems = jQuery('.tooltipContainer').length;
var i=0;
for (i=0; i<tooltipItems; i++){
jQuery('.tooltipContainer').eq(i).bind('click', function(){
var currentContainer = jQuery('.tooltipContainer').eq(i);
var currentDescriptionContainer = currentContainer.find('div');
var currentDescriptionText = currentDescriptionContainer.html();
console.log(currentDescriptionText);
showRendererToolTipForIpad(this, currentDescriptionText);
hideRenderedToolTipAfterTimeout();
});
}




No comments:

Post a Comment