

How do I activate or deactivate the button according to the value of the variabl...
source link: https://www.codesd.com/item/how-do-i-activate-or-deactivate-the-button-according-to-the-value-of-the-variable.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How do I activate or deactivate the button according to the value of the variable?
I use pure javascript. I have this row in my asp page:
<input type="button" value="..." id="ffcolorswtach" style="width: 20px; height: 19px; position: relative; left: 15px; top: 0px; color: #ff0000; background-color: #d8d5d5;" onclick="PickColor(1, false, false)" role="button" />
Also I have javascript variable in my client page that contains true/false values:
var isColorSelected
When isColorSelected is false i want to enable input element above if false I want to disable it.Any idea how can I implement it?
Try something like the following:
if(isColorSelected != true)
document.getElementById("ffcolorswtach").disabled = true;
else
document.getElementById("ffcolorswtach").disabled = false;
This is finding that element within the DOM and using the built in browser capability to disable the element for you.
Related Articles
How do I activate or deactivate the status item in the menu bar with a check box?
How to activate or deactivate any button in angle 2 according to the mandatory and optional field
Flash Actionscript 3 Activate or deactivate the menu buttons
How to hide, activate, modify WPF graphical interfaces according to different types of users?
Deactivate radio button according to date
How to improve var_dump to display the variable name and set the value of the variable to & lt; Pre & gt;
Count how many digits and letters in the variable using PHP
Activate or deactivate the foundation connection button
Activate or deactivate the button according to another button
Activate and deactivate the text box by pressing the
How do I activate javascript in the client window if it disables it in its browser?
How do I activate 'openssl' in the UwAmp CLI?
How do I activate and deactivate a component?
How to programmatically activate and deactivate GPS in Ionic Framework or Cordova
Recommend
-
21
使用指南 - @Livid - 比如这样的:https://www.v2ex.com/t/519424欢迎大家举报类似的其他水贴。---关于 Deactivate 是什么:https://ww
-
7
How to deactivate UA override on Firefox OSotsukare Thoughts after a day of workSome Web sites do not send the right version of the content to Firefox OS. Some ill-defined server side...
-
7
Product Information
-
6
Quickly activate or deactivate AirDrop using Control Center [Pro tip]There's no need to fi...
-
5
SAP Activate – Selecting apps using the UX Value Goals This blog post is currently applicable to the roadmap SAP Activate for RISE with SAP S/4HANA Cloud, private edition. Similar features may be extended to other...
-
20
-
8
Trying to activate / deactivate a contraction player with javascript in HTML advertisements So I'm trying to learn some HTM...
-
6
Sony Xperia 1 V: More camera specifications emerge with talk of improved variable zoom periscope camera
-
8
Question 14. Solve the following of equation graphically X – 2y + 11 = 0 3x + 6y + 33 = 0 Solution: Given that, x – 2y + 11 = 0 and 3x + 6y + 33 = 0 Now, x – 2y + 11 = 0
-
10
Mass changes Activate deactivate Open item management & OIM by ledger group ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK