Jquery read-only and jqueryinput read-only
Everyone understands what this is. The normal syntax is as follows:
If (status = true ){
$ ("# MinDelistStr"). val (totalAmount); // remove "," from the header and write it to the item id string.
$ ("# MinDelistStr"). attr ("readonly", true );
}
However, on the internet, I saw someone say:
JQuery (
$ ("# Id "). attr ("readonly": "readonly"); // Add the readonly attribute & $ ("# ID "). attr ({readonly: 'true '});
$ ("# Id"). removeAttr ("readonly"); // remove the readonly attribute
);
This is not correct. At least I tried it on Firefox.
How does jquery make all form elements read-only $ ("form input"). prop ("readonly", true );
All Form Controls readonly all readonly ~
Note that buttons are included in the input selector ~
Input ~
Use the not Selector
$ ("Input: not (: button,: hidden)"). prop ("readonly", true );
Hope to help you ~
By Billskate
How does jquery make the checkbox read-only and read-only to the example code:
<Html>
<Head>
<Script type = "text/javascript">
Function disable ()
{
Document. getElementById ("check1"). disabled = true
}
</Script>
</Head>
<Body>
<Form>
<Input type = "checkbox" id = "check1"/>
<Input type = "button" onclick = "disable ()" value = "Disable Checkbox"/>
</Form>
</Body>
</Html>
Understand. Please ask if it is helpful. Remember to adopt it ~