$(document).ready(function () { var textbox = document.getElementById("text1"); //event key down and key up and keypress textbox.onkeydown(function () { alert(); }); });
TypeError: textbox is null
@{ ViewBag.Title = "Index"; } <h2>Index</h2> <input type="text" id="text1 " />
id="text1 "
id="text1"
document.getElementById
id
<input type="text" id="text1" />
textbox.onkeydown = function () { alert("onkeydown"); };
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)