Going deeper
Let's discuss jQuery functions/methods that we use frequently in detail.
All the methods should be written in the ready()
function. Some of the commonly used methods are as follows:
Load
Keyup
Keydown
Change
Focus
Blur
Resize
Scroll
The load() method
Using this method, you can load a file on your browser. Consider that you want to fetch some text from a .txt
file on your browser. You can do the following coding:
<html> <head> <script type="text/JavaScript" src="jquery.js"></script> </head> <script> $(document).ready(function(){ $("button").click(function(){ $("#click").load("test.txt"); }); }); </script> <body> <div id="click"> Hello; </div> <button type="button" name="button">Click to replace "Hello" from text file</button> </body> </html>
After clicking the button, the text in the click
div will be changed to Congratulations! You have loaded...