Here's the jQuery:
$(function() {
$("#register-form").validate({
rules: {
fname: "required",
surname: "required",
middlename: "required",
},
messages: {
fname: "Please enter your name",
surname: "Please specify your surname",
middlename: "Please specify your surname",
},
submitHandler: function(form) {
form.submit();
}
});
});
Here's my HTML:
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post" id="register-form">
<table width="614" border="0">
<tr style="<?php echo $errorname_css; ?>">
<td width="153">First Name</td>
<td width="175">
<input type="text" name="fname" value="<?php echo $fname; ?>" /></td>
<td width="272">*<?php echo $fname_err; ?></td>
</tr>
<tr style="<?php echo $errorsurname_css; ?>">
<td>Surname</td>
<td><input type="text" name="surname" value="<?php echo $surname; ?>" /></td>
<td>*<?php echo $surname_err; ?></td>
</tr>
<tr style="<?php echo $errormidname_css; ?>">
<td>Middle Name</td>
<td><input type="text" name="middlename" value="<?php echo $middlename; ?>" /></td>
<td>*<?php echo $middlename_err; ?></td>
</tr>
<tr style="<?php echo $errormidname_css; ?>">
<td> </td>
<td><input type="submit" name="submit" value="Submit" /></td>
<td> </td>
</tr>
</table>
</form>
I would like to put the css inside the Jquery messages, but i dont know how, can someone help me with this? really appreciated, thanks :)