Skip to content

Invoke the ESC key to clear input fields with pure javascript

Notifications You must be signed in to change notification settings

alexschemagin/escapetoclear

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

ESC to Clear Input Values

Invoke the ESC key on the keyboard in Javascript to clear any inputs.

alt tag

It is also highlighted in this JS how to set different values and parameters for input fields through simple targeting.

The functionality is one of those things that, after a certain amount of use, leaves users thinking, "why is this not everywhere?". Needing to add the required onkeyup="if ( event.keyCode == 27 ) this.value=''" to every input field can be tedious and clutter otherwise simple markup. Invoking the functionality with Javascript elsewhere promotes clear readability.

About

Invoke the ESC key to clear input fields with pure javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published