I want to reload a particular div, which has an id corresponding to a table element’s id… (the div has only one table child).
the alert says tID is undefined.
javascript:
function (msg) {
var tID = $("table", msg).attr('id');
alert(tID);
$("#reloadme_"+tID).html(msg);
}
html:
<div id="reloadme_2036">
<table id="2036" class="customCSSclass">
...table contents...
</table>
</div>
Where have I gone wrong?
findlooks for descendants of the current set of elements inside the jQuery object, you should use.filterwhich filters the elements in the jQuery object itself:Of course, if it is the only element inside the jQuery object, there is no need for filtering.
=]Also, you’d use
.findfor e.g. looking fortr/tds (or any other element(s)) that are descendant of thetableelement referenced inside of your jQuery object.