简体   繁体   中英

jquery problems in IE6, anyone?

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() {
    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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM