Trying to create a test project using this library does not work in principle, here’s the code for the index and script:

$(document).ready(function() { $("#button").click(function() { $("#demo").html("Hello, World!"); }); }); 
 <!doctype html> <html lang="en"> <head> <title>Jquery Demo</title> </head> <body> <script type="text/javascript" src="js/jquery-3.3.1.js"></script> <script type="text/javascript" src="js/hi.js"></script> </body> </html> 

At the output instead of helovorld - a clean sheet, there are no errors in the console, the files are all in place ...

  • 2
    Well, it works. You just do not have a button with an id button , which when clicked adds Hello world to an element with id demo ... - RTK
  • Well, thanks for the answer, I understood my mistake, it's like walking with keys in your hands and looking for them in the corners) - Vladimir

1 answer 1

In your html page there is neither an element with id="button" , nor an element with id="demo" .

 $(document).ready(function() { $("#button").click(function() { $("#demo").html("Hello, World!"); }); }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <button id="button">Click</button> <div id="demo"></div>