+ 7
[SOLVED] Problem with form validation and display of elements in a code
When I press submit button in this code, I am automatically redirected to my browser's home page. It only happens on code playground. Also, the submit button works fine when I submit an option for the first time, but when I select another option and press the submit button, both the divs become displayed. I want only 1 div to be displayed in the latter case. Here is the code: https://code.sololearn.com/W9m4eldwe6cC/?ref=app Any working solution will be appreciated.
2 Answers
+ 5
Great work with tables!
In line 16 (HTML),
you should write
onsubmit='showData(); return false;'
In showData function, if(s == 'HTML') add
-> $("#JavaScript").css("display","none");
next, if(s == 'JavaScript') add
-> $("#HTML").css("display","none");
This is done because display: hidden; property not always work with table elements
+ 5
Problem solved. Thanks @Blue đ