• Resolved jeffrechten

    (@jeffrechten)


    I have a site that I manage with an admin plugin installed (called “Class Booking”). It leverages jQuery to do some things like show a datepicker and timepicker. At some point recently, the actions stopped firing on jQuery and I’m struggling to figure out how to debug what went wrong. I would greatly appreciate any help.

    Here’s what I’ve done so far:

    1. Googled.
    2. Tried adding my own custom jQuery function to see if the action would fire. It didn’t. Wrote a simple non-jQuery function using alert() and it did fire.
    3. I know next to nothing about this at this point, but I tried adding the following to the top of the php script in question.
      // Not sure why these aren't loading. I'm going to try again.
          wp_enqueue_script( 'jquery' );
          wp_enqueue_script( 'jquery-ui-core' );
          wp_enqueue_script( 'jquery-ui-datepicker' );

      That didn’t work.

    4. Enabled WP_DEBUG and SCRIPT_DEBUG but it didn’t show anything.
    5. Deactivated all plugins other than the one in use. No joy.
    6. Installed WP 4.5 from scratch on a new host and installed the plugin. It doesn’t work.
    7. Tested in IE, Firefox, and Chrome to see if it behaved differently, but no joy.

    I’m pretty lost. For that particular plugin, the developers aren’t active so that creates challenges. I’m a decent programmer but not experienced in developing on WordPress yet.

    I don’t have a site I can show you to replicate publicly because it’s an admin plugin but if you have a test env, it took me 5 minutes to reproduce by doing a clean install and installing “Class Booking”.

    TIA

    Here are excerpts from the plugin that are not working:
    class-booking/menu-pages/classes-manage.php

    <script>
            jQuery(function() {
               //load date picker js option
                jQuery('#start-date').datepicker({
                    dateFormat: 'yy-mm-dd'
                });
    
                jQuery('#end-date').datepicker({
                    dateFormat: 'yy-mm-dd'
                });
            });
    
            //time picker js
            jQuery(function(){
                jQuery('#start-time').clockface({
                    format: 'hh:mm A'
                });
                jQuery('#end-time').clockface({
                    format: 'hh:mm A'
                });
            });
        </script>

    and

    <div class="control-group">
                <label class="label label-info span2" style="padding: 8px 10px;"><?php _e("Start Date", "appointzilla"); ?></label>
                <div class="control pull-left">
                    <input type="text" placeholder="Select Class Start Date" id="start-date" name="start-date" value="<?php echo $StartDate; ?>" style="height: 32px; margin-left: 15px;">
                </div>
Viewing 1 replies (of 1 total)
  • Thread Starter jeffrechten

    (@jeffrechten)

    There was a unquoted # in the javascript file that was loaded before jquery. With 4.5, that’s not allowed. Quoting it fixed everything.

Viewing 1 replies (of 1 total)
  • The topic ‘jQuery not firing actions after something updated’ is closed to new replies.