javascript - jQuery - on('click') event doesn't work on dynamic objects -
javascript - jQuery - on('click') event doesn't work on dynamic objects -
this question has reply here:
event binding on dynamically created elements? 13 answers<ul id="listaatributos" class="editable isatribute"> <li>atributo 1<i class="js-remove">✖</i></li> <li>atributo 2<i class="js-remove">✖</i></li> <li>atributo 3<i class="js-remove">✖</i></li> </ul> $('#listaatributos').append('<li>atributo<i class="js-remove">✖</i></li>') $('.js-remove').on('click', 'js-remove', function(){ $(this).parent().remove() })
this code doesn't work, tell me why?
bind event parent element has been nowadays on dom
$('#listametodos').on('click', '.js-remove', function(){
javascript jquery
Comments
Post a Comment