innerHTML gets user input value, wait online_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:57:03
Original
2047 people have browsed it





For example, with the above html code, what I want to do now It is a rollback function, that is, the user modifies the input value and then returns after reaching the next page. The value entered by the user should be displayed instead of the default value.
Now I just simplified the problem and abstracted it. It actually contains many divs, and each div has many input and select controls. To implement the function of rolling back and saving data, I first thought of directly obtaining the outermost div. Then get the innerHTML attribute of the div and save it. When the user returns, the div will be rendered directly with the saved value. However, the innerHTML attribute can only save the value="0" hard-coded in the html. If the user changes 0 to 1, It cannot be obtained using innerHTML. Is there any way to solve this problem? Except for the stupidest method, get the values ​​of all inputs one by one and save them, and then set the values ​​one by one when rolling back.


Reply to discussion (solution)

The browser has this function, use js on the next page Back The data on the previous page will be saved, no change. Try it. .

The data in the form should be obtained through value()

Try jquery and set the input with name to get the array.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template