I'm working with my code that allows to user to add more fields then It will validate if the user entered data.
My code works but I want to change the message of error..
Instead of displaying "This field is required."
I want to display "Please select an option."
How can I do it with changing the background of blank inputs?
Here is my jsfiddle: http://jsfiddle.net/ThE5K/6/
$(document).ready(function () {
// MODE 1
var numberIncr = 1;
$("#addInput").on('click', function () {
$('#inputs').append($('<input class="comment required" name="name[' + numberIncr + ']" />'));
numberIncr++;
});
$('form.commentForm').validate();
});
<form class="commentForm">
<div id="inputs"></div>
<input type="submit" /> <span id="addInput">add element</span>
</form>