Cocher plusieurs checkbox avec un bouton
Résolu/Fermé
karim_Abdoul
Messages postés
1
Date d'inscription
lundi 30 mars 2015
Statut
Membre
Dernière intervention
30 mars 2015
-
Modifié par baladur13 le 31/03/2015 à 18:04
karim_Abdoul - 31 mars 2015 à 19:55
karim_Abdoul - 31 mars 2015 à 19:55
A voir également:
- Cocher plusieurs checkbox avec un bouton
- Réinitialiser chromecast sans bouton - Guide
- Comment cocher une case sans souris ✓ - Forum Windows
- Hard reset samsung sans bouton home - Guide
- Vba checkbox value ✓ - Forum Excel
- Comment cocher une case sur word ✓ - Forum Word
2 réponses
RAD ZONE
Messages postés
5224
Date d'inscription
samedi 20 janvier 2007
Statut
Contributeur
Dernière intervention
22 mars 2024
1 353
31 mars 2015 à 15:46
31 mars 2015 à 15:46
Salut
fait le en jquery ! voila un exemple vite fait
fait le en jquery ! voila un exemple vite fait
<!DOCTYPE html>
<html>
<head>
<title>
RAD ZONE Webcreation
</title>
<meta charset="utf-8">
<script src="https://code.jquery.com/jquery-2.1.3.min.js">
</script>
<script>
$(function()
{
enable_cb();
$("#radid2").click(enable_cb);
enable_cb2();
$("#radid1").click(enable_cb2);
/*click(function pour tout cheker ou dechecker */
$('#radid2').click(function()
{
$(':checkbox').checked(false);
}
);
$('#radid1').click(function()
{
$(':checkbox').checked(true);
}
);
$.fn.checked = function(value) {
if(value === true || value === false) {
$(this).each(function() {this.checked = value;});
}
/*click(function pour tout cheker ou dechecker */
/* peux etre utiliser si besoin
else if(value === undefined) {
$(this).each(function() {this.checked = !this.checked;});
}*/
};
}
);
function enable_cb() {
$("input.group1").prop("disabled", false);
}
function enable_cb2() {
$("input.group1").prop("disabled", true);
}
(jQuery);
</script>
</head>
<body>
<form name="maforme" id="maforme">
<input type="radio" id="radid1" name="radstate"> Tout les produits
<br>
<input type="radio" id="radid2" name="radstate"> Choisir Parmi la liste ci-dessous
<br>
<hr>
<br>
<input type="checkbox" name="chk1" class="group1">Riz
<br>
<input type="checkbox" name="chk2" class="group1">Sucre
<br>
<input type="checkbox" name="chk3" class="group1">Farine
<br>
<input type="checkbox" name="chk4" class="group1">Lait
<br>
</form>
</body>
</html>