Nothing happens? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Nothing happens?

This is my first time using J̛͜͢Qu͏ȩ̴r̨̛y͘ can someone help me with the code. I want it to alert when the user uses í̶̸̧͜o̸͝s̨͘͟͜͞ device and i want it to alert something else if any other device. I also want the background gif to appear when switch toggled on. https://code.sololearn.com/WdMtYPX1stHd/?ref=app

22nd Jun 2018, 8:44 PM
🅿️®️⭕️_e✖️e
🅿️®️⭕️_e✖️e - avatar
3 Answers
+ 4
just saying, using jQuery and JavaScript in the same code would sometimes confuse people reading your code, for example you used window.onload you could use jQuerys equivalent $(document).ready(function(){ // your code to run when the page loads }); and line 15, instead of document.getElementById() you can use var elem = $("#myElement"); which does the same thing...I could keep going but those are just a couple tips
23rd Jun 2018, 5:42 AM
MCJEH
MCJEH - avatar
+ 2
🅿️®️⭕️_e✖️e ,First of all, you are not to use double Window.onload
22nd Jun 2018, 11:43 PM
Dlite
Dlite - avatar
+ 1
Mystique is right plus there is a 'while' statement in your script that will never evaluate to true as the script stands now. https://code.sololearn.com/WBjfKt5QTBoV/#js
23rd Jun 2018, 12:50 AM
ODLNT
ODLNT - avatar