Answer the question
In order to leave comments, you need to log in
How to add code from html file to textarea using JavaScript(jQuery) or Node.js?
Hello!
How can I insert code from html file into textarea using JS? Or open this file, copy the code from there and also paste it with Node(fs)?
Answer the question
In order to leave comments, you need to log in
With jQuery:
$( "#textarea" ).load( "url-of-file-to-load", function( response, status, xhr ) {
if ( status == "error" ) alert( "Sorry but there was an error: " + xhr.status + " " + xhr.statusText );
else $( this ).val(response);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question