Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #15116

Re: Enable Disable UI Components using a ChackBox

From "Jukka K. Korpela" <jkorpela@cs.tut.fi>
Newsgroups comp.lang.javascript
Subject Re: Enable Disable UI Components using a ChackBox
Date 2012-07-20 11:20 +0300
Organization A noiseless patient Spider
Message-ID <jub4c4$etn$1@dont-email.me> (permalink)
References <e56c3d5e-fd60-409f-85eb-00f315308096@googlegroups.com>

Show all headers | View raw


2012-07-20 9:51, Pervez Mulla wrote:

> In my webpage I want to di[s]able some elements based on value of check box.
> All I want to do is, disable some components  when unchecking the Check-Box.and enable them, when checking the CheckBox.
> Could you tell me please, how to do that using JavaScript/jquery ?

The simplest approach is to associate an onclick event handler with the 
checkbox element, e.g. <input type=checkbox onclick="toggle()" ...>, 
with toggle() defined as a function that processes the elements 
suitably. For the processing part, jQuery would make the code shorter 
and simpler than using a loop in pure JavaScript.

The details depend on many things. Can the elements in question be 
distinguisher e.g. by a class attribute, or in some other simpler way? 
What exactly does "disable" mean? Something like a disabled input box 
(visible but grayed out and not clickable, not contributing to form 
data)? Or empty space where the element appears when "enabled"? Or 
complete absence, causing a redraw of the page on every "disable" and 
"enable"?

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Enable Disable UI Components using a ChackBox Pervez Mulla <mullapervez@gmail.com> - 2012-07-19 23:51 -0700
  Re: Enable Disable UI Components using a ChackBox Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-07-20 10:04 +0200
    Re: Enable Disable UI Components using a ChackBox Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-07-20 10:08 +0200
  Re: Enable Disable UI Components using a ChackBox "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-07-20 08:19 +0000
  Re: Enable Disable UI Components using a ChackBox "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-07-20 11:20 +0300

csiph-web