Bug in code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Bug in code

There is a bug in the clear function .every time it is pressed,the page becomes blank.When I tried to run the code on a browser,the page reloaded and function worked perfectly as expected.Any sugestions will be welcome https://code.sololearn.com/WsgW7AMuwlzS/?ref=app

30th Sep 2020, 10:58 AM
Ishaan Attam
5 Answers
+ 2
you can fix it by moving the buttons out of the form and renaming your "clear()" function to something else like cleared() , apparently it is conflicting with some built-in function in scope. I made those changes and it worked without reloading the page. https://code.sololearn.com/Wckn5qC6EDuc/?ref=app
30th Sep 2020, 2:48 PM
Bahhaⵣ
Bahhaⵣ - avatar
+ 2
thanks
30th Sep 2020, 3:05 PM
Ishaan Attam
+ 2
thanks again
1st Oct 2020, 4:47 PM
Ishaan Attam
+ 1
do u have any recomendations on how to remove the border when the clear button is pressed???
30th Sep 2020, 4:13 PM
Ishaan Attam
+ 1
add to cleared() document.getElementById("presentees_box").style.display ="none"; document.getElementById("absentees_box").style.display ="none"; and document.getElementById("presentees_box").style.display =""; document.getElementById("absentees_box").style.display =""; to myFunction() check my code above for the changes
30th Sep 2020, 4:26 PM
Bahhaⵣ
Bahhaⵣ - avatar