It is very simple to load .txt or any other file in textarea/div
(anywhere you want) using jQuery. This tutorial helps you to load a text file from your server or your system to your destination page. let’s see how you can do it.
we are using .load()
jQuery method to load .txt file without clicking any button. It will load automatically once you run your code.
The .load()
method, unlike $.get()
, allows us to specify a portion of the remote document to be inserted. This is achieved with a special syntax for the URL parameter.
Example:
Load another page’s contents into textarea.
You can change /compiler/examples/loadfile.txt with your path or URL.