6

How do I activate or deactivate the button according to the value of the variabl...

 2 years ago
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.
neoserver,ios ssh client

How do I activate or deactivate the button according to the value of the variable?

advertisements

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?

I have already created a status item for the menu bar but I would like to add a checkbox to make it able to be toggled on and off. So when the check box is checked the status item is displayed and when the checkbox is not checked it is not displayed.

How to activate or deactivate any button in angle 2 according to the mandatory and optional field

I want the my Save button to be enabled when Placeholder value is 'Optional'.When the value is 'Mandatory' the Save button should be disabled and get enabled only if I enter some value for that field. My template- <md-input name="" [placehold

Flash Actionscript 3 Activate or deactivate the menu buttons

This is probably really simple but i cant figure it out. Take a look at the code, i moved 2 instances of this button class (CategoryButton) onto the stage. As you can see when you click a button it should gotoAndPlay(3), record itself as the selected

How to hide, activate, modify WPF graphical interfaces according to different types of users?

So I want to implement admin, non-admin (casual) user style priviledges for an app, but it's only on the GUI level. So for instance, to disable a few GridViewColumns, hide some buttons, etc. What's the proper way to do this in WPF? I plan to implemen

Deactivate radio button according to date

I'm a novice in Javascript, and trying to figure out how to using Javascript to disable radio button attribute In my form, I have a date picker and 10 radio buttons below. I want some radio buttons turn to gray if specific date is selected, and some

How to improve var_dump to display the variable name and set the value of the variable to & lt; Pre & gt;

I've been using var_dump() function many times in my scripts to check the actual value and type of the variable. For long time it was enought to make function vardump() witch is defined below: function vardump($_var){ echo '<pre>'; var_dump($_var);

Count how many digits and letters in the variable using PHP

I'd like to count how many numbers and letters are in the variable using PHP. Below if my code: $lot_num = strtoupper('e1,1,2,3,4,5,7,8,9,10,11,12,13,14,15,16,17,18,e18'); echo 'END UNIT: '.substr_count($lot_num, 'E').'<br />'; the code will count h

Activate or deactivate the foundation connection button

I`m use front-end framework Foundation. How i can in this menu enable Log in button only if Login and Password input filled text. <form data-abide="ajax"> <div class="row"> <div class="large-12 columns"> <

Activate or deactivate the button according to another button

I am new in C#. I have two button and two label. What I want is that, When I click button1 it start counting and shows in label1. When I press button2 it resume counting under button1 and start counting under button2 and shows in label2. Here is my c

Activate and deactivate the text box by pressing the

I have multiple of textbox...each textbox have own button to enable or disable . How to do it ? I have already try this $('#disablebutton').click(function(){ $('#textfieldToClose').attr('disable'); }); <input type="text" name="text11&quo

How do I activate javascript in the client window if it disables it in its browser?

How to enable javascript in client window if it disables it in his browser?How to enable javascript in client window if it disables it in his browser? If Web browser features could be bypassed, users would feel very insecure surfing the Web. Short an

How do I activate 'openssl' in the UwAmp CLI?

i have UwAmp installed. and i'm using php cli command with composer, it says 'you must enable openssl extension'. i'm sure i was enabled openssl in all php ini every version i have. how to enable openssl for uwamp cli?I had the same problem using UwA

How do I activate and deactivate a component?

My initial question was basically something along the lines of this: Clearing and setting the default home application That question was answered to my satisfaction, however, the thing I'm having difficulty understanding in the answer is how do you e

How to programmatically activate and deactivate GPS in Ionic Framework or Cordova

My problem is simple. I need a way to turn on and off GPS using a button inside an Ionic app. I've check the docs and read this ng-cordova plugin http://ngcordova.com/docs/plugins/geolocation/ but they don't seem have this funcction. Am I just missin

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK