get html content of next element with a defined classname
- by Carasuman
i have problems with jquery..
If i have this code to fill tooltip div
<div id="tooltip"></div>
<div class="tooltipMessage">Tooltip Message</div>
<script type="text/javascript">
$("#id").html($("#tooltip").next(".tooltipMessage").html());
</script>
Works, the code takes the next element with classname "tooltipMessage" and fills element with id "tooltip".
But if i have this code:
<div id="tooltip"></div>
<p>other element</p>
<div class="tooltipMesage">Tooltip Message</div>
Returns "undefined". How i can take html from the next element with classname "tooltipMessage" if exists another element in middle ?
Thanks for help!.