In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how jquery modifies the name of input. It is very detailed and has certain reference value. Friends who are interested must read it!
In jquery, you can use the attr () method to modify the name property value of input, which is used to set or return the property value of the selected element, with the syntax of "input element object .attr ('name', modified name attribute value)".
The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.
How jquery modifies the name of input
In jquery, you can use the attr () method to modify the value of the name property of input by getting the input object.
Create a new html file, named test.html, to explain how jquery modifies the name of input. In the p tag, use the input tag to create a text box and set its name attribute value to user.
Set the id of the input tag to myinput, which is mainly used to obtain the input object through this id. Create a button with the name of "modify name property" using the button tag. Bind the onclick click event to the button button, and execute the editname () function when the button is clicked.
Create the editname () function. Within the function, get the input object through id (myinput), and use the attr () method to modify the name property to username, as follows:
Open the test.html file in the browser and click the button to view the source code.
After clicking the button:
Summary:
1. Create a test.html file.
2, in the file, in the p tag, use the input tag to create a text box, and set its name attribute value to user, and create a button button to trigger the execution of the js function.
3. In the js tag, create a function, within the function, get the input object, and use the attr () method to modify the name attribute to username.
Matters needing attention
The attr () method modifies not only the value of the name attribute, but also the attribute value of the element.
The above is all the contents of the article "how jquery modifies input's name". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.