Good morning, all.
I've been trying to use Jorn's validation plug-in and I've
gotten everything working except placement of the
message. I want to put it on top of the field it's responsible
for.
Jorn gave these instructions and I've tried to implement them,
as you'll see in the code below, but I can't get it to work.
Here's Jorn's instructions:
$("#myform").validate({
errorPlacement: function(error, element) {
// do whatever you like with error and the element, eg.:
error.insertBefore(element); // <- inserts the error before the element,
use next() or prev() or parent() on element etc. to navigate through the DOM
}
});
I've tried this without success. Anyone doing this successfully?
Thanks!
Rick
Here's what I've tried:
$.validator.defaults.debug = true;
$().ready(function() {
// validate Mortgage_Calculation_Form form fields on blur
$("#MC_Form").validate({
errorPlacement: function(error, #Principal) {
error.insertBefore(#Principal);
},
focusInvalid: "false",
event: "blur",
rules: {
Principal: {required: true},
Interest: {required: true,
number: true},
Years: {required: true,
number: true}
},
messages: {
Principal: "Please enter the Principal.",
Interest: {required: "Please enter the
Interest Rate.",
number: "Please enter a
number."},
Years: {required: "Please enter the Years.",
number: "Please enter a number."}
}
})
});
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/