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

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -