I'm no expert with jquery, and I'm having trouble with a reaction to a click event. I have a form with two checkboxes, what I need is that when I click on one of them the other one is automatically unchecked. I wrote a jquery code that perfectly works on laptop but not on smartphone. I have this form:
<form method="get" action="categorie.php">
<input id="eatcheck" class="check" type="checkbox" name="eat&drink" value="1" />
<input id="shopcheck" class="check" type="checkbox" name="shopping" value="1" />
<input class="btn" id="labels-btn" type="submit" value="Aggiorna risultati">
</form>
and that's the script:
<script>
$('#eatcheck').click(function() {
if ($(this).attr('checked')) {
$('#shopcheck').attr('checked', false); }
});
$('#shopcheck').click(function() {
if ($(this).attr('checked')) {
$('#eatcheck').attr('checked', false); }
});
</script>
Thanks in advance to anyone can help! Margherita
Aucun commentaire:
Enregistrer un commentaire