How to Input Box Key Press Event work in JQuery ?


  <input type="text"   style="width: 100%; height: 28px;" name="txtInput" id="txtInput"/>

// in javascript
 $("#txtInput").keypress(function (event) {
        if (event.keyCode == 13) {
            var id= $("#txtInput").val();
            if (id != '') {
                //do work
            }
            else {
                //do work
            }
        }
    });




Post a Comment

0 Comments