Seems that you are putting me on the way but
$(this.id) outputs [object Object]
Onno Timmerman wrote:
Olivier Percebois-Garve schreef:
Hi
It seems that there is cases where it is not possible to get attributes.
How to deal with this ?
$(this).val() // works
$(this).name() //not working
$(this).id() //not working
more like $(this.id);
etc...
Here is my code :
$.fn.checkform = function() {
this.bind("click", function(){
msg='';
$("input.check_empty").each(function(){
if(this.value!='') {
$(this).css("background", "#fff");
} else {
//alert($(this).name()); //breaks the script
alert($(this).val());
msg += 'is empty\n';
$(this).css("background", "#ff0");
$(this).after("<strong>is
empty</strong>");
};
});
$("input.check_email").each(function(){
if
(this.value.search(/^\w+((-\w+)|(\.\w+))[EMAIL PROTECTED]((\.|-)\w+)*\.\w+$/) != -1) {
$(this).css("background", "#fff");
} else {
msg += 'is not email\n';
$(this).css("background", "#fff0ff");
$(this).after("<strong>is not
email</strong>");
};
});
alert("Please correct:\n"+msg);
if (msg!='') return false;
else return true;
});
};
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
|
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/