+ 4

JavaScript: condition on line 52 doesn't work in code though it doest out of code. Anyone who is good at JavaScript?Nobody know?

Test it on jsbin here on solo it doesn't work. The problem is that when a reply button is clicked it must add some text in block with id=aname and then if the tag contains that text run the code but it doesn't work in this code despite if u take out that bit of the hole code it work pretty well. https://code.sololearn.com/WWZJnxEl17EK/?ref=app

14th Apr 2022, 11:20 AM
Pozik
Pozik - avatar
8 Respostas
+ 3
My bad I meant add the code with changes I was referring to in my reply 😅🤦‍♂️ https://code.sololearn.com/WpiSiXyh1QEz
15th Apr 2022, 4:11 PM
ODLNT
ODLNT - avatar
+ 2
Million thanks to u man. Ur the best.
15th Apr 2022, 4:24 PM
Pozik
Pozik - avatar
+ 1
Are you running the code in SoloLearn Android app? if so, then the error message about localstorage was shown because web storage is not available in the app. It's an issue related to WebView.
14th Apr 2022, 11:49 AM
Ipang
+ 1
localStorage is not restricted on SoloLearn
14th Apr 2022, 11:50 AM
Gordon
Gordon - avatar
+ 1
Instead of checking if the comment is a reply at line 52, it should be done in the click handler that starts on line 9 by doing so you can add a flag to the comment object indicating if the comment is a reply to a previous comment. You will also need to change line 52 to check if item.isReply is true or false. edit: https://code.sololearn.com/WpiSiXyh1QEz
15th Apr 2022, 3:39 PM
ODLNT
ODLNT - avatar
+ 1
Yeah, it seems to be it overriding the facus of oncklick or something like that have to read about it a littlebit.
15th Apr 2022, 3:59 PM
Pozik
Pozik - avatar
0
Then why it shows error here on solo learn?
14th Apr 2022, 11:55 AM
Pozik
Pozik - avatar
0
Here, sololearn is denying the access to localstorage. It's also written the error.
15th Apr 2022, 3:10 AM
Arnav Gumber
Arnav Gumber - avatar