My form something like this
Form.html
<div class="wrapper">
<form action="" method="post" id="myForm">
<div class="form-input">First name = <input type ="text" name="fname" ><div class="error">First Div</div></div>
<div class="form-input">Last Name = <input type="text" name ="lname" ><div class="error">Second Div</div></div>
<input type="submit" name ="submit" value="submit">
</form>
</div>
I want to get Text() form each error class by jquery
JQuery code :-
$(function() {
$('#myForm').submit(function(e) {
e.preventDefault();
var $inputs = $('#myForm :input');
$inputs.each(function() {
var data = $(this).val();
alert($(this).html());
/* Here i want to get each error class text by jquery */
});
});
Please give me some way to get something like this if this is possible by jquery
Thank you all :)
$(this).next('.error').html()