tooltip - jQuery Select the next element using a selector -
i know can use .next() find next element of given one. however, situation forces me use selector.
i'm using jquery tools build tooltips of table, each "td" having 2 elements: link , tooltip div. goal display tooltip when mouse hovers on link. according html, it's placed right after link need select "the next element". html looks like:
<tr> <td><a href="#" id="td1">title</a> <div class="tooltip"> <h1>tooltip title</h1> <p>a detailed descritpion</p> </div> </td> </tr> <tr> <td><a href="#" id="td2">title</a> <div class="tooltip"> <h1>tooltip title</h1> <p>a detailed descritpion</p> </div> </td> </tr> <!-- more rows --> unfortunately, cannot use .next() here since tooltip() function accepts selector string argument:
$("#mytable img").tooltip({ tip: '.tooltip', // <-- must string, no next() position: 'center right', offset: [0, 15], delay: 0 }); is there way achieve this, or have restruct html? many thanks.
you can try this
$("#mytable img").tooltip({ tip: '#mytable img your_html_element', // <-- must string, no next() position: 'center right', offset: [0, 15], delay: 0 }); here your_html_element may div or span or html element tag. can give name of tag. same how using img tag.
Comments
Post a Comment