How Many Types Of Events Are There In A Textbox? Could You Explain Me About Keypress And Keydown Events With Examples?

1 Answers

Rajesh Shri Profile
Rajesh Shri answered
Textbox is the text input field where the user can enter the text. It is also called as text field or text entry box and is always in rectangular shape.

There are different types of textboxes such as single line text box, multi- line textbox, non-editable textbox. Single line textbox has no scroll bar and allows only one line input data whereas multi-line textbox has one or two scroll bars and allows multi-line input data.

Data in the textbox is entered from the keyboard that has different keys. Event in a textbox is the process or the action done by the user. There are many types of events such as click, double click, drag drop, drag enter, enter, key press, key down, key up, etc.

The action of pressing and immediately releasing the key is called as 'keypress' event. For example, to enter the letter 'k' in the textbox, we press and immediately release the 'k' letter key. This is called as keypress event.

The action of pressing the key without releasing it, is called as 'keydown' event. For example, we press the 'g' letter key and keep it pressing without releasing the key. This is called as 'keydown' event.

Answer Question