I am using jQuery and the jQuery Validation plugin to validate inputs. Below is the code. Now there are many inputs named like question1, question2, question3, question4,... How can I place validation on them? I mean how to select them all together?
$(document).ready(function() {
$("#item").validate({
rules: {
title: {
required: true,
minlength:40
},
content: {
required: true,
minlength:100,
maxlength:2000
}
},
messages: {
}
});
});
The code:
$("input[name^='question']"): {
required: true,
minlength:40
}
does not work.