开发者

jquery problems in IE6, anyone?

开发者 https://www.devze.com 2023-01-22 07:05 出处:网络
function validate_request_form(){ var valid = true; if ( document.request_form.firstname.value == \"\" )
function validate_request_form(){
   var valid = true;
   if ( document.request_form.firstname.value == "" )
   { alert ( "Please fill in first name" ); valid = false; return false; }  
   return valid;
 }

$j('#video-request-form').submit(function() {
 开发者_Python百科   if (!validate_request_form() )
    return false;
});

I am using this code to validate my form. My form has id=video-request-form and the form name is request_form. This all works fine in latest FF, but can't get it to work in IE6...anyone?


I suggest utilizing jQuery more instead of native JS. They are they to help. Try the following:

function validate_request_form(){
   var valid = true;
   if ( $j('#firstname').val() == "" ) {
     alert ( "Please fill in first name" ); valid = false; return false;
   }  
   return valid;
}

This assumes the field has an ID of firstname

0

精彩评论

暂无评论...
验证码 换一张
取 消