Onload event in <form> tag
I want a JavaScript function to execute on page load.
I added an attribute onload
to the tag <form>
but it alert
fails.
What am I doing wrong?
<form name=myfm method=post action=quiz.php onload = alert('hello')>
+3
Sudarshan taparia
source
to share
2 answers
try adding onload
to tagbody
<body onload="alert('Hello World')">
+3
TheSk8rJesus
source
to share
// javaScript
window.onload = function{
alert("loaded");
}
// jquery
$(document).ready(function() {
$("#div-id").click(function(){
alert("the page is loaded");
});
});
0
Careen
source
to share