Removing following jQuery click function

I am trying to add form validation to a custom post type in WordPress with Jquery. Everything is working fine, except that there is a built in click event attached to the submit button that adds a class to make the button look disabled and also show the loading gif.

Now the form doesn’t actually submit, but it looks like it does to a user, and this is confusing to a client. I tried adding removeClass to my validation script, but the built in script fires after mine and so I can’t seem to do anything to affect it.

Read More

Is there a way of stopping this click event firing when the form is returned false, preferably without trying to find it in the WordPress files (as this will not be worth it I feel)

Thanks

Update:

The part of the script (in autosave.js) that is adding the class is here

b('input[type="submit"], a.submitdelete', "#submitpost").click(function () {
        blockSave = true;
        window.onbeforeunload = null;
        b(":button, :submit", "#submitpost").each(function () {
            var c = b(this);
            if (c.hasClass("button-primary")) {
                c.addClass("button-primary-disabled")
            } else {
                c.addClass("button-disabled")
            }
        });
        if (b(this).attr("id") == "publish") {
            b("#ajax-loading").css("visibility", "visible")
        } else {
            b("#draft-ajax-loading").css("visibility", "visible")
        }
    });

This is a bit too in depth for me, I’m not that adept at javascript. I’m not expecting anyone to get the wordpress files out, but can anyone immediately tell me what is happen at a glance? I’m thinking of just removing the addClass function as a cheap and tacky workaround (which I’ll have to update every version), but I would of course prefer not to do that.

Related posts

Leave a Reply

1 comment