JS alert not working | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

JS alert not working

Hi guys. I'm working on a Html Blog practicing my little skills, and I tried to add some JS code, with an alert, and it was working fine since I made it some weeks ago, and today i went in to modify it, and suddenly it wont come up. The JS just dont work. And i dont know what i didn. Could anyone check and let me know? My Blog is in my profile thanks in advance

28th Jun 2018, 1:56 AM
Ana De Janón
Ana De Janón - avatar
6 Answers
+ 9
You failed to close your textarea. Added line 77 in this version and it works. https://code.sololearn.com/W8Fet8y8lMYU
28th Jun 2018, 2:28 AM
John Wells
John Wells - avatar
+ 5
Ana I have found the solution copy and paste the JS part into the the javascript file labeled JS Here is the code: https://code.sololearn.com/W4QD9oJ15IBS/?ref=app Ana blog However, you can move the code to the top, inside your body tag so it is the first thing that is shown like this: https://code.sololearn.com/WLv8vxY69Re3/?ref=app Ana blog 2
28th Jun 2018, 2:06 AM
Agent
Agent - avatar
+ 3
Hi Ana I copied your JS part into a blank html file and the alert worked Don’t know what is wrong
28th Jun 2018, 2:02 AM
Agent
Agent - avatar
+ 2
Guys, alert function surely can work on script code located bottom of html codes before closing body tag. There must be some syntax errors like John Wells mentioned to stop the script tag from parsing the JavaScript codes.
28th Jun 2018, 2:43 AM
Calviղ
Calviղ - avatar
+ 2
Thanks everyone for your comments and solution. I appreciate them all! John Wells was right, i missed the textarea closing. Now its working! thank you very much! 😊
29th Jun 2018, 12:31 PM
Ana De Janón
Ana De Janón - avatar
0
Put the script in the head, and it should work.
28th Jun 2018, 2:17 AM
Boris Batinkov
Boris Batinkov - avatar