Hey guys, been a while since I've been here, but still the best source for help. Hoping you guys can help me with a checkbox/radio button scenario.
HTML...
<div style='margin-bottom:5px;'>
<div style='float:left;width:49%;text-align:left;'><input class='toppingChecked' type='checkbox' id='top-".$row['id']."' value='".$row['topping']."' /> ".$row['topping']."</div>
<div style='float:left;width:7%' class='lblLeft'>
<input type='radio' class='css-checkboxLeft countToppingSelect' name='top-".$row['id']."' id='top-left-".$row['id']."' value='Cheese' />
<label for='top-left-".$row['id']."' class='lblLeft'>
<img src='img/layout/halfCirleLeft.png' width='16' height='16' alt='' />
<img src='img/layout/halfCirleLeftON.png' width='16' height='16' alt='' />
</label>
</div>
<div style='float:left;width:7%' class='lblCenter'>
<input type='radio' class='css-checkboxAll countToppingSelect' name='top-".$row['id']."' id='top-all-".$row['id']."' value='Cheese' />
<label for='top-all-".$row['id']."' class='lblCenter'>
<img src='img/layout/fullCircle.png' width='16' height='16' alt='' />
<img src='img/layout/fullCircleON.png' width='16' height='16' alt='' />
</label>
</div>
<div style='float:left;width:7%' class='lblRight'>
<input type='radio' class='css-checkboxRight countToppingSelect' name='top-".$row['id']."' id='top-right-".$row['id']."' value='Cheese' />
<label for='top-right-".$row['id']."' class='lblRight'>
<img src='img/layout/halfCirleRight.png' width='16' height='16' alt='' />
<img src='img/layout/halfCirleRightON.png' width='16' height='16' alt='' />
</label>
</div>
</div>
CSS...
/* Hiding radio button */
.css-checkboxLeft {display:none;}
/* Hiding second image in label tags */
.lblLeft > img:nth-child(2) {display:none;}
/* When radio-button is checked, display second image in the following label tag */
input[type='radio']:checked + .lblLeft > img:nth-child(1) {display:none;}
input[type='radio']:checked + .lblLeft > img:nth-child(2) {display:inline-block;}
/* Hiding radio button */
.css-checkboxAll {display:none;}
/* Hiding second image in label tags */
.lblCenter > img:nth-child(2) {display:none;}
/* When radio-button is checked, display second image in the following label tag */
input[type='radio']:checked + .lblCenter > img:nth-child(1) {display:none;}
input[type='radio']:checked + .lblCenter > img:nth-child(2) {display:inline-block;}
/* Hiding radio button */
.css-checkboxRight {display:none;}
/* Hiding second image in label tags */
.lblRight > img:nth-child(2) {display:none;}
/* When radio-button is checked, display second image in the following label tag */
input[type='radio']:checked + .lblRight > img:nth-child(1) {display:none;}
input[type='radio']:checked + .lblRight > img:nth-child(2) {display:inline-block;}
the idea is to click the checkbox, which will automatically select the center radio button (toppings on all of pizza), and secondly (vice-versa) (if left, right, or center is selected, the checkbox corresponding is as well) (think dominos).
The idea was some sort of combination of these jQuery functions for the first scenario, but I haven't found the correct combo yet, any ideas?
jQuery...
$('.toppingChecked').change(function(){
if (this.checked)
{
$(this).parent().next().eq(1).find("input").prop("checked", true);
}
});