jquery - $(this) limitation outside of scope to target specified element -


if want delete specified li in ul, u this

$('ul').on('click',function(){     $(this).find('li').remove(); }); 

but case, i'm selecting submit button of dialog box.. can't use $(this), either direct select li, because remove all..

$('#submit).click(function(){    //delete 1 of target li.. }); 

you can use two-step process following javascript code

$('li').on('click',function(){     var id = $(this).attr("id");     $("#c" + id).show(); });  $(".confirm").on("click", function(){     var id = ($(this).attr("id")).substring(1, 2);     $("#" + id).remove(); }); 

working fiddle here


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -