High!
What i want to do is the following: i have a table with a onclick attached to a link that resides in the table of an even row. every odd row is hidden. on a click
The problem is this:
$(this).click(function(){
attachHideMyChildren();
});
When you call a function that way this
becomes window
. Instead do this:
$(this).click(attachHideMyChildren);
Also, you're adding click()
handlers without removing the old ones.
That being said, there is an easier way of doing this.
$("a.version").click(function() {
var next = $(this).closest("tr").next();
if (next.is(":hidden")) {
$.get($(this).attr("href"), function(sData) {
next.find("td:first").html(sData);
next.show();
});
} else {
next.hide();
}
return false;
});
should about do it.