[Solved]Need a help with jQuery ! | Sololearn: Learn to code for FREE!
0

[Solved]Need a help with jQuery !

The strikethrough feature of my todo list doesn't work when I have more than one item in my list . https://code.sololearn.com/W8s9DCVL2Wx0/?ref=app

29th Sep 2020, 2:25 PM
Hima
Hima - avatar
9 odpowiedzi
+ 1
Try adding this before the rem click function $(".rem").unbind('click')
29th Sep 2020, 2:55 PM
Ruba Kh
Ruba Kh - avatar
+ 1
I just tested it again ... Seems it works sometimes, and sometimes only works partially (one of four items isn't getting strike through effect) I got no idea why yet ...
29th Sep 2020, 2:59 PM
Ipang
+ 1
Ruba Kh unbind is deprecated though . worked fine with off.
29th Sep 2020, 2:59 PM
Hima
Hima - avatar
+ 1
I see my mistake. I am not removing the eventlistener after adding one . With that said , the moment I tap on the cross , the class gets added but the next moment the gets removed as well as I'm using toggleclass .
29th Sep 2020, 3:01 PM
Hima
Hima - avatar
0
Works from here ...
29th Sep 2020, 2:52 PM
Ipang
0
Ipang do you mean it works fine for you ?
29th Sep 2020, 2:53 PM
Hima
Hima - avatar
0
Yes it is working fine for me ... Added 3 to do lists Press the 'x' button on each item And they got strike through effect ...
29th Sep 2020, 2:55 PM
Ipang
0
Ipang it did not work with me
29th Sep 2020, 2:56 PM
Ruba Kh
Ruba Kh - avatar
0
Yup the same idea 👍🏼 because each time you add click it duplicate the click function and it won't work so you make it off before making it on another time
29th Sep 2020, 3:01 PM
Ruba Kh
Ruba Kh - avatar