Question:
How to disable list in javascript?
NSP
2010-04-11 17:27:31 UTC
My xhtml form displays two questions (1st qu is a check box selection and 2nd qu is drop down list):

1. Which of our classes have you attended?
Aerobics
Boxing
Circuit Class
Weight Training

2. Which of the above classes has been most beneficial for you?

(You can only choose one from the list): (4 selections)

How do i make it so that a selection from question 2 can only be made if at least one checkbox is selected in question 1? So if question 1 isnt answered then question 2 is disabled.

heres my code for the form:




1. Which of our classes have you attended?

Aerobics

Boxing

Circuit Class

Weight Training



2. Which of the above classes has been most beneficial for you?


(You can only choose one from the list):




....

Thank You.
Three answers:
AQuestionMark
2010-04-13 17:11:30 UTC
Try the following steps

1. change this



then option box by default is disabled and it got an id called op1



2. between the script tags, add this

function enableOption(){

document.getElementById( "op1").disabled=false;

}





3. add onClick="enableOption();" to all lines of checkbox like

Aerobics




Then only if one or more checkbox is clicked, function enableOption will be called, and enable the option button with id op1
?
2016-05-04 04:03:39 UTC
1
anonymous
2016-10-16 03:18:30 UTC
I observed the different answer. i anticipate he's making variations together as logged in with administrator privileges. needless to say, the administrator login desires a password. Does that block javascript on the constrained account and forestall the consumer from reversing the technique? that's doubtful. shop in mind that javascript is this way of ordinary information superhighway ingredient that blockading it could make most of the information superhighway inaccessible.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...