JQuery TextboxTextbox are used to collect user entered data. Mainly it is used along with other componenets to collect data.
Reading the data entered in textboxOur text box id=t1, here is the code to read the value entered inside a text box.
Here we stored the text box data in a variable str.
We can display the data entered by connecting it to a button click function.
Show or Hide the Text Box
Read more on Show & Hide elements
Disable the text boxWe can disable a text box or enable it by managing prop
Here the button with id b2 on Click will disable the text box , same time button with id b3 will enable it by using click function.
Disable textbox based on selection of checkboxWe can connect the textbox to a checkbox where on selection of checkbox the textbox can be enabled. By default we will keep the textbox disabled.
Setting the value of textbox
Making the value empty
Selecting value inside textbox
Getting id and value of group of text box with common classWe have several textboxes with different id and different value but with common class. Here is how we will collect the id and value of the textbox which the user put the crusher or the textbox in focus.
We will use blue event of the group to hide the display of value.
We have used one div element ( id = display ) to show the collected id and value of the textbox.
Here is the code.