0
Is That a Good practice or bad
$(document).ready(function() { $('#add').click(function(){ var val = $("input").val(); var elem = $("<li></li>"); var elem2 = $(elem).append(val); if(val !==''){ $('#mylist').append(elem2); $(elem2).append("<button class='rem'>X</button>"); $('input').val(""); $('.rem').click(function(){ $(this).parent().fadeOut(); }); } else{ alert("plz write something in inputbox") } }); });
3 Respostas
0
click inside click... not good
0
@yaroslav
yup i did not notice this.
this is ok. it seems to be there. according to sololearn lesson.
https://code.sololearn.com/1134/#js
0
I think this will be better
https://code.sololearn.com/WGaJj9rMA2AS/#js