0
I need help with this code....it keeps on giving me this error....$ not defined: line 1
this is the html <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <input type="text" id="userInput"/> <div id="msg"></div> </body> </html> this is the jQuery $(function(){ $("#userInput").keydown(function (){ $("msg").html($("userInput").val()); }); });
6 ответов
+ 13
There's an error in your code. $('msg').html($('userInput').val()); should be $('#msg').html($('#userInput').val());
Don't forget to include jQuery.
+ 12
@Elijah, you need to include jQuery. Use the link @Rob Howard posted.
+ 1
You need to include jQuery file in the HTML code.
+ 1
You can add this somewhere between <head> & </head>:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
0
I am using the sololearn code playground on my fone so I thought it wasn't necessary to include jQuery
0
thank you guys