简体   繁体   中英

jQuery change form action doesn't work for some IE 7 users

I'm having a puzzling issue with Javascript/jQuery and a handful of IE 7 users. I'm lost since I can't reproduce the issue with any IE 7 installation. Here's the code:

   $("form").submit(function() {
            $(this).attr("action",$(this).attr("action").replace(/^\/foo/,""));
            $("input[type=submit]", this).attr("value","Please wait...");
            $("input[type=submit]", this).attr("disabled","true");
            return true;
    });

This removes for /foo from the form action and submit's the form without issue in all modern browsers. But for some reason with SOME IE 7 users it doesn't update the action and submits it to the original.

I thought it was an issue with loading jQuery from Google, but I've moved it locally and other jQuery code executes from this same file without an issue.

Try making the regex case insensitive. ( /^\\/foo/i )

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