How to disable spacebar in text box control using jquery
In this article I'm going to explain How to disable space bar in text box control using jquery.
Just drag and drop one text box control to your asp.net web page. When user try to press space bar control its not allowing.
In this article I'm going to explain How to disable space bar in text box control using jquery.
Just drag and drop one text box control to your asp.net web page. When user try to press space bar control its not allowing.
Example:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" src="jquery-1.2.6.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#TextBox1").keydown(function(event) {
if (event.keyCode == 32) {
event.preventDefault();
}
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>
nice..