Home > Web Front-end > JS Tutorial > Implementation code to make page controls unavailable based on jquery_jquery

Implementation code to make page controls unavailable based on jquery_jquery

WBOY
Release: 2016-05-16 18:28:30
Original
933 people have browsed it
Application background

When users need a certain function, they need to fill in some form information. After filling in and submitting, this part of the information is not allowed to be modified again. The form contains TextBox, DropDownList, CheckBox and other controls.

Requirement realization

The first solution is to set the Enable property of the control to False when binding the data filled in by the user. This method can be used if the number of forms on the page is small, but it is not a better method if there are many forms.

The second option is to use Foreach to access the page control. If the type is TextBox, DropDownList, CheckBox, etc., set Enable=False. The amount of code is reduced compared to the first solution, but it is still not optimal.

The third option can be easily implemented using Jquery.


Copy code The code is as follows:
$("input").attr( "disabled", "disabled");


Summary

There are many ways to achieve the same function. How to find a faster way in specific scenarios? The more suitable one, that's what we want.
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