'Jquery validation rules from loop?
I have this dynamic textbox and I want to put it into validation rules.
I want to make the rules based on how many clothes there is dynamically from database using a while loop.
$(document).ready(function() {
$('#sales').validate({
rules: {
'clothe[1]': {
required: true
}
'clothe[2]': {
required: true
}
}
});
<form id="sales">
<td><input type="text" name="clothe[1]" id="clothe[1]"></td>
<td><input type="text" name="clothe[2]" id="clothe[2]"></td>
</form>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
