I noticed that in many functions in javascript I see at the end a return true
.
function EscreveDados(){
document.getElementById("divData").value = 'texto';
return true;
}
In HTML we have the tag which calls the function followed by a "return" as well.
<form method="post" onsubmit="return EscreveDados()">
<textarea id="divData"></textarea>
</form>
What is the purpose of using these return
within the code? I have this doubt because I did the test and took out the return
and apparently the function worked normally, what would be the difference between using or not using return
?