Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set button properties by javascript

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

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.

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report