I’m trying to insert some text in a file into <textarea></textarea> in an html file when one clicks a link in a different html page.
html1.html:
<a href="#" id="link">click to add text</a>
html2.html:
<form action="...">
<textarea id="txt"></textarea>
</form>
js:
$(".link").click(function(){
window.location = "./html2.html";
var text = $("#some_id").text();
$("#txt").val(text)
});
Once you migrate to the new page any further JS execution is lost. You’d have to do something like this, passing the text to the new page in a query string variable:
And have some code like this on your
html2.htmlpage: