-5
When I run javascript, it runs normally, my doubt was, like I get the code now from this table that the script changed.
-5
When I run javascript, it runs normally, my doubt was, like I get the code now from this table that the script changed.
3
Using the Local Storage of HTML5 you can save textarea text locally, so even though you close the file the values will be there.
Code:
<!DOCTYPE html>
<html>
<body>
<html><table><textarea id='result'>Escreva aqui seu lembrete</textarea></table></html>
<button onClick="salvar()">Salvar</button>
<script>
function salvar() {
// Check browser support
if (typeof(Storage) !== "undefined") {
// Store
localStorage.setItem("text", document.getElementById("result").value);
} else {
document.getElementById("result").innerHTML = "Local Storage não suportado";
}
}
// Retrieve
document.getElementById("result").innerHTML = localStorage.getItem("text");
</script>
</body>
</html>
JS Fiddle: https://jsfiddle.net/5ndnu2nn/
Browser other questions tagged textarea
You are not signed in. Login or sign up in order to post.
You want to save the text typed in the textarea where? only html I believe is not possible. At least you will need javascript, even I do not believe it is possible to save data in the machine direct javascript.
– user28595
Save where? ..
– Jéf Bueno
I have this html ae, only saved on my pc. I open it in my browser, as I put the save button to it save in my pc html.
– anon
What HTML on your PC?
– Jéf Bueno
<html> <table><textarea>Tester</textarea></table> </html>
– anon
You want to make a button to save or just put this text in the textarea?
– Rafael Kendrik
Save where? That’s the question!
– Jéf Bueno
To save the typed content in the textarea you must first place it in a form and submit the submission through an input type Submit, as a reading suggestion I recommend the following link: http://tableless.com.br/formulario-basic-in-8-minute/. About how to save is relative, you want to do save in a txt file, database...?
– Rafael Kendrik
maybe he wants to use something like HTML5’s Storage site http://www.w3schools.com/html/html5_webstorage.asp
– jbrunoxd
just put this text in the textarea
– anon