Support » Plugin: Simple Custom CSS and JS » JS is not working after wp core update 5.3

  • Resolved rajthakur7

    (@rajthakur7)


    Hello,
    First of all, I would like that you guys for your amazing work. This really helped me alot.
    Issue: After I have updated wordpress 5.3 & wp database,
    The plugin just stopped working. It isn’t showing the JS code, but before update it was working fine. Also, other methods are working fine like directly inserting code & similar methods.
    My JS code: `var switcher$ = $(‘.switcher’),
    switchTarget$ = $(‘.switch-target’);

    switcher$.on(‘change’, switchIframeSrc);

    function switchIframeSrc() {

    switchTarget$.attr(‘src’, switcher$.val());
    }

    switchIframeSrc();`

    I am using this code to switch between iframes on post.
    Hence, I would like to request you to please solve/check this issue with plugin.

    Regards.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Diana Burduja

    (@diana_burduja)

    Hello,

    on our test website the plugin works alright to add JS code.

    Could you please describe in more details what you mean by “plugin stopped working”. Can you open the “WP Admin -> Custom CSS & JS -> Add Code” page? Do you get any errors on the page? Can you click the “Save” button? Can you edit the code again afterwards? If you open the frontend HTML, can you find your code within the HTML?

    Do you have any caching plugins installed on your website?

    Do you have a link so I can also have a look at the frontend?

    rajthakur7

    (@rajthakur7)

    Hello,

    Thanks for the quick response.
    Deep apologies for not expressing more details.

    So, the the plugin is working fine on the backend, I am able to add the JS code & even save it.
    The code is visible on the front end, I can see the js code on the site by inspect element(code is visible in the HTML), but It’s just not working, before Wp core update 5.3, it was working fine.
    Yes, I have wp-super-cache plugin.

    I can send you link in private as it is NSFW & it might not be appropriate here.

    Thanks,

    Regards.

    Plugin Author Diana Burduja

    (@diana_burduja)

    If the code is visible in the HTML, then the plugin is working alright.

    The issue might have to do with the “compatibility mode” for jQuery in WordPress. Here is an article about it.

    Try changing $() with jQuery() in your code. Similar to:

    var switcher$ = jQuery('.switcher'),
    switchTarget$ = jQuery('.switch-target');
    
    switcher$.on('change', switchIframeSrc);
    
    function switchIframeSrc() {
    
    switchTarget$.attr('src', switcher$.val());
    }
    
    switchIframeSrc();

    Note that I didn’t test the aforementioned code.

    rajthakur7

    (@rajthakur7)

    Hello,

    Thanks for responding so quickly!

    Yess..!! 🙂 It worked, changing $() with jQuery() in the code, did the trick.
    Thanks for the golden suggestion.
    Please accept my deep gratitude.

    Thanks again,

    Regards.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.