How to set button properties by javascript
This article mainly introduces the javascript how to set button properties related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone after reading this javascript how to set button properties article will have a harvest, let's take a look at it.
Javascript sets button attributes: 1, the button is clickable and unclickable through disabled in js; 2, whether the button is clicked or not through attr; 3, add the attribute "disabled=" true "in the label.
This article operating environment: windows7 system, javascript1.8.5 version, Dell G3 computer.
How does javascript set button properties?
Set clickable and non-clickable button in javascript
1. The settings button in js is clickable or unclickable. It is clickable by default.
(1) the setting button is not clickable
Document.getElementById ("bt1"). Disabled=ture
(2) the setting button can be clicked
Document.getElementById ("bt1"). Disabled=false
2. The settings button in jq is clickable or unclickable. It is clickable by default.
(1) the setting button is not clickable
("# bt1") .attr ("disabled", ture)
(1) the setting button can be clicked
("# bt1") .attr ("disabled", false)
3. The setting button in the label is not clickable.
Add the attribute disabled= "true" to the tag.
Buttons with input type of button, submit, or reset are unclickable as long as they have a disabled attribute, regardless of whether the attribute has a value or not; on the contrary, they can be clicked without this attribute.
For example
Not clickable, clickable, clickable I believe you all have a certain understanding of the knowledge of "how to set button properties in javascript". If you want to learn more, you are welcome to follow the industry information channel.