instead of example:
$(".myfield").blur(function() {
// validate
})
$(".myfield").keyup(function() {
// validate
})
is there a way to combine these two?
instead of example:
$(".myfield").blur(function() {
// validate
})
$(".myfield").keyup(function() {
// validate
})
is there a way to combine these two?
In case you want to validate each for itself...
$('.myfield').live('blur keyup', function(event) {
if (event.type == 'blur') {
// validate on blur
}
if (event.type == 'keyup') {
// validate on keyup
}
});
As a side note, you might want to take a look att the jQuery Validate Plugin.