Hi,
I have a registration form which displays a list of dietary requirements as checkboxes.
i.e.
1. No requirements
2. Vegetarian
3. No fish etc...
I've already setup some PHP to check whether user has "checked" No requirements and any additional diets, the code then marks this as an error.
My question is how can de-select "No requirements" if any other diet is then selected? I know this will involve js I just dont know how to code it.
Thanks.
De-select checkbox onclick on another checkbox
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: De-select checkbox onclick on another checkbox
aceconcepts wrote:I know this will involve js I just dont know how to code it.
Moved to client-side.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
MMM JavaScript...
Code: Select all
<label for="mmm_meat" onclick="document.getElementById('mmm_carrots').checked = false;"><input checked="checked" id="mmm_meat" name="requirements" type="checkbox" />MMM Meat</label>
<br style="clear: both;" />
<label for="mmm_carrots" onclick="document.getElementById('mmm_meat').checked = false;"><input id="mmm_carrots" name="requirements" type="checkbox" />MMM Carrots</label>