I'm attempting to add form validation to some custom publish key in Wordpress with Jquery. Things are working fine, with the exception that there's a built-in click event connected to the submit button that contributes a category to create the button look disabled as well as show the loading presen.

The form does not really submit, however it appears like it will to some user, which is confusing to some client. I attempted adding removeClass to my validation script, however the built-in script fires after mine therefore i can't appear to complete almost anything to affect it.

It is possible to method of preventing this click event firing once the form is came back false, ideally without looking for it within the Wordpress files (because this won't be worthwhile Personally i think)



Negligence the script (in autosave.js) that's adding the course is here now

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")) {
            } else {
        if (b(this).attr("id") == "publish") {
            b("#ajax-loading").css("visibility", "visible")
        } else {
            b("#draft-ajax-loading").css("visibility", "visible")

This really is a little too thorough for me personally, I am not too skilled at javascript. I am not expecting anybody to obtain the wordpress files out, but could anybody immediately let me know what's happen instantly? I am considering just getting rid of the addClass be the cheap and tacky workaround (which I'm going to update every version), however i would obviously prefer to avoid that.

You have to take away the click handler around the objects, not only the course.


Check this out publish How to use .removeClass() to disable jquery function