+ 1

Why my code not working on mobile ?

I create a code that is work perfectly with PC but when i try to test it via mobile not working. You can check it on my codes "How many years sleeping ?!!". I use only jQuery library and bootstrap CSS to be responsive. Thanks in advanced for all suggesions.

7th Aug 2017, 11:10 AM
Mokhtar Tlili
Mokhtar Tlili - avatar
3 Answers
+ 10
It works but you putted your submit button in a form and the default browser's behaviour is redirect the user... you can prevent it, just add one more line in your JS tab, here the code: https://code.sololearn.com/W5XMRQia31yf/?ref=app
7th Aug 2017, 11:46 AM
Maz
Maz - avatar
+ 5
First, you need to close the <form> tag before closing <body> ^^ Next, you can also fix the 'problem' of submit behaviour by using an <input type="button"> (or <button type="button"> -- but you need to explicitly set 'type="button"' as default behaviour is to have a 'submit' type button) and its 'onclick' event listener, rather than listening for 'onsubmit' event of the <form> ;)
7th Aug 2017, 12:57 PM
visph
visph - avatar
+ 2
Oops What a huge mistake hahaha :D Thanks a lot Maz. Problem Fixed
7th Aug 2017, 11:53 AM
Mokhtar Tlili
Mokhtar Tlili - avatar