/    Sign up×
Community /Pin to ProfileBookmark

check box enables option buttons but not reverse

I created a function that enables disabled option buttons when a check box is clicked. My problem is that when you click the checkbox again it doesn’t disable the option buttons. I set the options to disabled on page load in the body tag

<!–
function checktrainVal()
{

if(document.forms[0].checkbox6.checked = true)
document.forms[0].training[0].disabled=false;
else
document.forms[0].training[1].disabled=true;

if(document.forms[0].checkbox6.checked = true)
document.forms[0].training[1].disabled=false;
else
document.forms[0].training[0].disabled = true;
}
//–>

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@schizoJul 09.2004 — It's probably just your JavaScript syntax. Use == when doing "if" comparison equalities.

I.E.

if(document.forms[0].checkbox6.checked == true)

document.forms[0].training[0].disabled=false;

...
Copy linkTweet thisAlerts:
@icode4uauthorJul 09.2004 — its the simple things that elude us
Copy linkTweet thisAlerts:
@schizoJul 09.2004 — It's ok, I have the same problem... far too many languages in my head.
×

Success!

Help @icode4u spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...