jQuery validation plugin click checkbox to remove disable another checkbox -
is there way remove checkbox disable checkbox disable? below code:
<head> <link rel="stylesheet" type="text/css" media="screen" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/cupertino/jquery-ui.css" /> <link rel="stylesheet" type="text/css" media="screen" href="http://jquery-ui.googlecode.com/svn/branches/dev/themes/base/ui.button.css" /> <script src="jquery-validation-1.8.1/lib/jquery.js" type="text/javascript"></script> <script src="jquery-validation-1.8.1/lib/jquery.metadata.js" type="text/javascript"></script> <script src="jquery-validation-1.8.1/jquery.validate.js" type="text/javascript"></script> <link rel="stylesheet" href="style.css" media="screen" /> <script> $(document).ready(function() { $("#platinum").click(function () { $("#schedule").removeattr("disabled") }); }); </script> </head> <div> </div> <h3>booking confirmation</h3> <div style="border: medium none;display: inline;padding: 0;text-align:left"> <h4>i wish participate in jump start vitality challenge program:</h4> <p><input id="platinum" class="checkbox" type="checkbox" value="platinum" name="program[]" validate="required:true,minlength:1,maxlength:1" />platinum level - $677 - 5 sessions per week</p> <p><input id="gold" type="checkbox" value="gold" name="program[]" />gold level - $497 - 2 sessions per week</p> <p><input id="silver" type="checkbox" value="silver" name="program[]" />silver level - $297</p> </div> <div style="border: medium none;display: inline;padding: 0;text-align:left"> <h4>i wish participate in jump start vitality challenge program, , current jump start client:</h4> <p><input type="checkbox" value="platinum - current client" name="program[]" />platinum level - $598 - 5 sessions per week</p> <p><input type="checkbox" value="gold - current client" name="program[]" />gold level - $418 - 2 sessions per week</p> <p><input type="checkbox" value="silver - current client" name="program[]" />silver level - $218</p> </div> <p><label class="error" for="program[]" >please select one.</label></p> <div> <table> <tr><td><h3>payment options</h3></td></tr> <tr> <td> <h4><input type="checkbox" value="paypal" name="payment[]" validate="required:true,minlength:1,maxlength:1" />1. credit card or paypal </h4> <iframe src="paypal.php" width="100%" height="100%" style="border:none"> </iframe> </td> </tr> <tr> <td> <br/> <h4>2. bank transfer</h4> <p><input type="checkbox" value="bank transfer" name="payment[]" />i securing place sending in completed forms , transferring full amount jump start bank account. please send email receipt number once done.</p> <ul> <li>bank: westpac</li> <li>account name: jump start personal training pty ltd</li> <li>account number: 351 539</li> <li>bsb: 032197</li> </ul> <br/> <h4><input type="checkbox" value="call office" name="payment[]" />3. call office on (02) 9904 1201 credit card details payment.</h4> <p><label class="error" for="payment[]" >please select one.</label></p> </td> </tr> </table> </div> <table cellpadding="7" cellspacing="0" width="657" style="padding:5px;border:solid 1px;" id="schedule"> <thead> <tr> <td><h3>monday</h3></td> <td><h3>tuesday</h3></td> <td><h3>wednesday</h3></td> <td><h3>thursday</h3></td> <td><h3>friday</h3></td> <td><h3>saturday</h3></td> </tr> </thead> <tbody> <tr> <td><input name="schedule[]" id="schedule" type="checkbox" value="fitness circuit 6.30-7.30am" disabled="disabled" /><p>fitness circuit<br/> <span>6.30-7.30am</span></p></td> <td><input name="schedule[]" id="schedule" type="checkbox" value="fit 2 box 6.30-7.30am" disabled="disabled" /><p>fit 2 box<br/> <span>6.30-7.30am</span></p></td> <td><p align="center"> </p></td> <td><input name="schedule[]" id="schedule" type="checkbox" value="fit 2 box 6.30-7.30am" disabled="disabled" /><p>fit 2 box<br/> <span>6.30-7.30am</span></p></td> <td><input name="schedule[]" id="schedule" type="checkbox" value="fitness circuit 6.30-7.30am" disabled="disabled" /><p>fitness circuit<br/> <span>6.30-7.30am</span></p></td> <td><p align="center"> </p></td> </tr> <tr> <td><input name="schedule[]" id="schedule" type="checkbox" value="run 4 fun 6.30-7.30am" disabled="disabled" /><p>run 4 fun<br/> <span>6.30-7.30am</span></p></td> <td><p> </span></p></td> <td><input name="schedule[]" id="schedule" type="checkbox" value="fitness circuit 7.30-8.30am" disabled="disabled" /><p>fitness circuit<br/><span>7.30-8.30am</span></p></td> <td><input name="schedule[]" id="schedule" type="checkbox" value="core strength 7.15-8.15am" disabled="disabled" /><p>core strength<br/> <span>7.15-8.15am</span></p></td> <td><p><span> </span></p></td> <td><input name="schedule[]" id="schedule" type="checkbox" value="walk 2 trot 8.30-9.15am" disabled="disabled" /><p>walk 2 trot<br/><span>8.30-9.15am</span></p></td> </tr> <tr> <td><p><span> </span></p></td> <td><input name="schedule[]" id="schedule" type="checkbox" value="fitness circuit 9.30-10.30am*" /><p>fitness circuit<br/> <span>9.30-10.30am*</span></p></td> <td><input name="schedule[]" id="schedule" type="checkbox" value="fitness circuit 9.30-10.30am*" /><p>fitness circuit<br/> <span>9.30-10.30am*</span></p></td> <td><input name="schedule[]" id="schedule" type="checkbox" value="fitness circuit 9.30-10.30am*" /><p>fitness circuit<br/> <span>9.30-10.30am*</span></p></td> <td><input name="schedule[]" id="schedule" type="checkbox" value="fitness circuit 9.30-10.30am" /><p>fitness circuit<br/> <span>9.30-10.30am</span></p></td> <td><input name="schedule[]" id="schedule" type="checkbox" value="core strength 9.30-10.30am" /><p>core strength<br/><span>9.30-10.30am</span></p></td> </tr> <tr> <td><p><span> </span></p></td> <td><p><span> </span></p></td> <td><p><span> </span></p></td> <td><p><span> </span></p></td> <td><input name="schedule[]" id="schedule" type="checkbox" value="fitness circuit 10.30-11.30am*" /><p>fitness circuit<br/><span>10.30-11.30am*</span></p></td> <td><input name="schedule[]" id="schedule" type="checkbox" value="fitness circuit 10.30-11.30am" /><p>fitness circuit<br/><span>10.30-11.30am</span></p></td> </tr> <tr> <td><input name="schedule[]" id="schedule" type="checkbox" value="fitness circuit 6.30-7.30pm" /><p>fitness circuit<br/><span>6.30-7.30pm</span></p></td> <td><input name="schedule[]" id="schedule" type="checkbox" value="fitness circuit 6.30-7.30pm" /><p>fitness circuit<br/><span>6.30-7.30pm</span></p></td> <td><input name="schedule[]" id="schedule" type="checkbox" value="fit 2 box 6.30-7.30pm" /><p>fit 2 box<br/><span>6.30-7.30pm</span></p></td> <td><input name="schedule[]" id="schedule" type="checkbox" value="fitness circuit 6.30-7.30pm" /><p>fitness circuit<br/><span>6.30-7.30pm</span></p></td> <td><p><span> </span></p></td> <td><p><span> </span></p></td> <p><label class="error" for="schedule[]" >please select sessions.</label></p> </tr> </tbody> </table> i want remove disable id #schedule checkbox when click id #platinum checkbox...
you not allowed have multiple dom elements same id in document. should make sure id unique on page.
with in mind, select elements name[] , disable them way:
jquery < 1.6, 1.61
$(document).ready(function() { $("#platinum").click(function() { $("input[name='schedule[]']").removeattr("disabled"); }); }); jquery >= 1.6
$(document).ready(function() { $("#platinum").click(function() { $("input[name='schedule[]']").prop("disabled", false); }); });
Comments
Post a Comment