Can you put jquery in html? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can you put jquery in html?

I have been trying to understand this new language jquery. is there any chance to be able to add the js code in html with jquery configuration (code)? For example: html code ------------------------- <script src="https://code.jquery.com/jquery-3.1.1.js"></script> JavaScript code -------------------------- $(function() { $("#item").click(function() { $("#submenu").slideToggle(500); }) how would u get the JavaScript code and place it in html without the code failing?

10th Mar 2017, 8:08 AM
Wilde Night
Wilde Night - avatar
4 Answers
+ 4
You should write it inside a <script></script> tag.
10th Mar 2017, 8:35 AM
Álvaro
10th Mar 2017, 9:52 AM
Álvaro
+ 1
sweet thx @álvaro that help a lot and its now working in html xD idky I stuck <script type="javascript/text"> force of I guess, can't believe I didn't figure this one out by myself anyway thx again for helping
10th Mar 2017, 10:01 AM
Wilde Night
Wilde Night - avatar
0
I've tried that and it didn't work @álvaro
10th Mar 2017, 8:37 AM
Wilde Night
Wilde Night - avatar