access $(this) with href="javascript:..." in JQuery -
i using jquery. call javascript function next html:
<li><span><a href="javascript:uncheckel('tagvo-$id')">$tagname</a></span></li> i remove li element , thought easy $(this) object. javascript function:
function uncheckel(id) { $("#"+id+"").attr("checked",""); $("#"+id+"").parent("li").css("color","black"); $(this).parent("li").remove(); // not working retrieveitems(); } but $(this) undefined. ideas?
try (e.g. hide <li>):
function uncheckel(id, ref) { (...) $(ref).parent().parent().hide(); // should <li> } and link:
<a href="javascript:uncheckel('tagvo-$id', \$(this))"> $(this) not present inside function, because how supposed know action called from? pass no reference in it, $(this) refer <a>.
Comments
Post a Comment