0

Currently I'm working on a local copy of site which uses multi site feature. And there's a strange thing with jQuery script. On main site it works completely correct, but on subdomain the part of this script doesn't work.

For example:

demo.example.com/wp-admin/post-new.php?post_type=incsub_event

This works great, but this doesn't work:

example.com/wp-admin/post-new.php?post_type=incsub_event

Here's the console: enter image description here

Here's the function which doesn't work:

$("#eab-eab-start_recurrence-button").click(toggle_recurrence_settings);

function toggle_recurrence_settings () {
    var text = $("#eab-eab-start_recurrence-button").val();
    var alter = $("#eab-eab-start_recurrence-button").attr("data-eab-alter_label");
    $("#eab-eab-start_recurrence-button").val(alter);
    $("#eab-eab-start_recurrence-button").attr("data-eab-alter_label", text);
    if (!$("#eab_event-recurring_event").is(":visible")) show_event_recurrence();
    else hide_event_recurrence();
    return false;

}

What could be the reason of such strange behavior?

7
  • what is the point of asking a question about your code without showing it? please edit the question and include relevant code – Mark Kaplun Sep 6 '16 at 14:30
  • The problem is that the code is not mine. It's just a script from plugin. But I will add a part of code which doesn't work to the question. – Paul Kotula Sep 6 '16 at 14:38
  • 1
    It would be best to direct this question to the plugin's developer who would be able to give you better support for this scenario. – Ethan O'Sullivan Sep 6 '16 at 14:42
  • plugin related questions should be asked at their support venues – Mark Kaplun Sep 6 '16 at 14:43
  • The problem is mostly related to the multisite feature, because on the main domain it works perfectly. – Paul Kotula Sep 6 '16 at 14:52
0

The problem was that the function itself was declared before the initialization of button that wasn't working. So the replacing of button init before the function declaration resolved the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.