Email: Password:       Forgot Password 
    .netCodeSG
A Saarsha Group Online Community for dot net codes group like C#, Asp.NET, VB.NET, Sharepoint, JavaScript, JQuery, Ajax, SQL, WCF, WPF.
 
TECHNOLOGIES:
 

Make Default enter key Using jquery

Article:
Viewed:  994 
Posted On:  03/10/2012 10:47:02 
In this article I am going to show how we can define a default enter key by using JQuery. 

 

This is the script to set Default enter key

<script language="javascript">
    $(document).ready(function () {
        $(
"input").bind("keydown", function (event) {
            
var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
            
if (keycode == 13) {
                document.getElementById(
'MyButton').click();
                
return false;
            }
 else {
                
return true;
            }
        });
    });
</script>

 

<input id="ISearch" type="text" onblur="if(this.value=='')this.value=this.defaultValue;"
onfocus="if(this.value==this.defaultValue)this.value='';" value="search"/>

<input type="button" id="MyButton" />

  Comment:
         HOME   |   Submit Article   |   Contact Us   |   About Us   |   Terms & Condition   |   Advertise With us