JQuery Load Text File
From w3cyberlearnings
Contents |
jQuery $.load() to load content
The $.load() method uses to fetch content into a match element.
Syntax
$("div.text1").load("fruits.txt");
Example TRY-IT
fruits.txt is the file content.
<!DOCTYPE html> <html> <head> <title>Load Text</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="jquery.min.js"> </script> <script> $(document).ready(function(){ $("div.text1").load("fruits.txt"); }); </script> </head> <body> <div class="text1"></div> </body> </html>
Related Links
- jQuery Width and Height
- jQuery Hide and Show
- jQuery Load Text File