Home >Web Front-end >HTML Tutorial >Setting the disabled attribute cannot read data in the background. How to make select support readonly_HTML/Xhtml_web page production

Setting the disabled attribute cannot read data in the background. How to make select support readonly_HTML/Xhtml_web page production

WBOY
WBOYOriginal
2016-05-16 16:37:141402browse

Copy code
The code is as follows:




1》Set the readonly attribute of the form
Problem: But the readonly attribute has no effect on the three forms of radio, select, and checkbox

2》Set the disabled attribute of the form

Problem: After setting the disabled attribute, the data cannot be read in the background

Method:

1. Set the disabled attribute and store the form value in the hidden field
2. Use jquery control (set the form attribute disabled=true when loading the page, and set the form attribute disabled=false when submitting the form)

Code:

Quote the jquery file



Use script to control disabled Attributes

Copy code
The code is as follows:



Note this: input[name=category]
input is the form type (for example, select is a drop-down box)
name=category The name of the form
Statement:
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