Sunday, 11 August 2013

input button click event not firing in html 5

input button click event not firing in html 5

I don't know why my code is not executing. I am simply assigning textbox
value to paragraph's innerHTML on button click.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Error handling</title>
<script>
$(document).ready(function () {
$("btnName").click(function () {
var x = document.getElementById("Demo");
x.innerHTML = document.getElementById("txtName").value;
alert("Done");
});
});
</script>
</head>
<body>
<input id="txtName" type="text" />
<br />
<input id="btnName" type="button" value="Try It" />
<p id="Demo"></p>
</body>
</html>

No comments:

Post a Comment