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") } }); });

14th Mar 2017, 5:28 PM
Faisal Imran
Faisal Imran - avatar
3 Respostas
0
click inside click... not good
14th Mar 2017, 5:38 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
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
14th Mar 2017, 5:42 PM
Faisal Imran
Faisal Imran - avatar
0
14th Mar 2017, 5:50 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar