I've got a box with checkboxes and I wanted that button 'submit' appear only if one checkbox was marked, When more than one box is checked the button 'submit' must disappear, I've tried code it using addClass and removeClass provides by Jquery, here's my code for now:
$('.a').click(function() {
$('.c').removeClass('b');
});
.b {
display: none;
}
<script src="http://ift.tt/Zv5K7g"></script>
<div class="checkbox">
<form method="post">
<fieldset>
<legend>What is Your Favorite Pet?</legend>
<input type="checkbox" name="animal" value="Cat" class="a" />Cats
<br />
<input type="checkbox" name="animal" value="Dog" class="a" />Dogs
<br />
<input type="checkbox" name="animal" value="Bird" class="a" />Birds
<br />
<input type="submit" value="Submit now" class="c b" />
<button>Cancel</button>
</fieldset>
</form>
</div>
Aucun commentaire:
Enregistrer un commentaire