Current location - Quotes Website - Personality signature - How to get the name value in the button with jquery?
How to get the name value in the button with jquery?
You can use the attr function of jquery to get the name value in the button.

1. Create a new html document, add an input tag in the body tag, the tag type is button, set an id for this tag, and then import the jquery file:

2. Get the input label with the previously set id, and the code format is $('#id name'). At this point, the input tag with the previously set id will be selected:

3. Add an attr function to the selected label, and the parameter of the function is name. At this point, the name value in the button is obtained: