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
7 ответов
+ 9
You failed to close your textarea. Added line 77 in this version and it works.
https://code.sololearn.com/W8Fet8y8lMYU
+ 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
+ 3
Hi Ana
I copied your JS part into a blank html file and the alert worked
Don’t know what is wrong
+ 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.
+ 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! 😊
0
Put the script in the head, and it should work.