this question is over my skill.
If I uncheck checkbox 3, I want to change the value of input 3, 4, 5, 6, 7, 8, 9.
If I uncheck checkbox 6, I want to change the value of input 6, 7, 8, 9.
If I uncheck check X, I want to change the value of input X++.
I wrote this jquery code :
<code>
$('input[type=checkbox][name=checkbox_5]').on('change', function () {
if ($(this).is(":not(:checked)")) {
$('input[type=text][name=input_5]').val('');
$('input[type=text][name=input_6]').val('');
$('input[type=text][name=input_7]').val('');
$('input[type=text][name=input_8]').val('');
$('input[type=text][name=input_9]').val('');
}
});
</code>
I have 9 checkbox. I don't want to wrote for each checkbox this snippet. Can you help me to fix this ?
I prefer to use increment, but I don't know how to do it.
Aucun commentaire:
Enregistrer un commentaire