13
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;
}
and 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 the use of these return
within the code? I have this doubt because I took the test and took the return
and apparently the function worked normally, what would be the difference between using or not using the return
?