In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces jquery how to add read-only or disabled attributes to the tag related knowledge, the content is detailed and easy to understand, the operation is simple and fast, with a certain reference value, I believe that after reading this jquery how to add read-only or disabled attributes to the tag article will have a harvest, let's take a look.
1. JQuery
JQuery is a JavaScript library.
JQuery greatly simplifies JavaScript programming.
JQuery is easy to learn.
Example:
$(document) .ready (function () {$("p") .click (function () {$(this). Hide ();})
Source code:
Rookie tutorial (runoob.com) $(document) .ready (function () {$("p") .click (function () {$(this). Hide ();})
If you click me, I will disappear.
Keep clicking on me!
Then click on me!
Running result:
The running result of the above picture will disappear as long as you click on the text. Interested partners can go down and have a try.
Second, about the readonly attribute
Example 1. Jquery sets the readonly property
$('input') .attr ("readonly", "readonly") / / set the input element to readonly$ (' input') .removeAttr ("readonly"); / / remove the readonly attribute if ($('input'). Attr ("readonly") = true) of the input element / / determine whether the readonly attribute has been set for the input element
Example 2. Methods for setting the readonly attribute and canceling the readonly attribute for an element
$('input'). Attr ("readonly", true) / / set the input element to readonly$ (' input'). Attr ("readonly", false) / / remove the readonly attribute of the input element $('input'). Attr ("readonly", "readonly") / / set the input element to readonly$ (' input'). Attr ("readonly", ") / remove the readonly attribute of the input element. Jquery sets the disabled attribute.
Example 1. Jquery sets the disabled property
$('input') .attr ("disabled", "disabled") / / set the input element to disabled$ (' input') .removeAttr ("disabled"); / / remove the disabled attribute if ($('input'). Attr ("disabled") = true) of the input element / / determine whether the disabled attribute has been set for the input element
Example 2. Methods for setting the disabled attribute and canceling the disabled attribute for an element
$('input'). Attr ("disabled", true) / / sets the input element to disabled$ (' input'). Attr ("disabled", false) / / removes the disabled attribute of the input element $('input'). Attr ("disabled", "disabled") / / sets the input element to disabled$ (' input'). Attr ("disabled") ") / / remove the disabled attribute of the input element. 4. Jquery dynamically add the readonly read-only attribute of the text box $(" # test ") .attr ({" readonly ":" readonly "}) / / add readonly attribute / / or $("# ID"). Attr ({readonly: 'true'}); $("# test"). RemoveAttr ("readonly"); / / remove the readonly attribute on "how to add read-only or disable attributes to tags". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how jquery adds read-only or disabled attributes to tags". If you want to learn more, you are 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.