Yesterday worked on interesting thing. Requirement was to clear the textbox text when escape (Esc) key is pressed within textbox. This was easy and simple.
- Bind keyup event with textbox/textboxes.
- Check the keycode.
- If keyCode is 27 (which is for esc key) then clear the text.
$(document).ready(function() {See result below
$('input[type="text"]').keyup(function(e){
if(e.keyCode == 27) {
$(this).val('');
}
});
});
See Complete Code
Feel free to contact me for any help related to jQuery, I will gladly help you.
No comments:
Post a Comment