Support » Plugin: Just Custom Fields » jQeuery Error “.live is not a function”

  • Resolved netzgestaltung

    (@netzgestaltung)


    Hi there,

    i think wordpress kicked out the jquery-migrations plugin so all occurences of “.live” should be changed to “.on”

    I get this error when i try to add a field to a fieldset of a post type:

    Uncaught TypeError: jQuery(...).live is not a function
    .../wp-content/plugins/just-custom-fields/assets/just_custom_fields.js?ver=5.5:95

    in there you have:

    // init delete button on change popup
      jQuery('#jcf_ajax_content .jcf_edit_fieldset a.field-control-remove').live('click', function() {
    ...

    as quick fix you can enqueue the jquery migrations plugin with your plugin

    kind regards
    tom

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter netzgestaltung

    (@netzgestaltung)

    And while writing this, Query monitor outputs a deprecated notice:

    Deprecated Array and string offset access syntax with curly braces is deprecated

    at

    .../wp-content/plugins/just-custom-fields/core/JustField.php:326

    Thread Starter netzgestaltung

    (@netzgestaltung)

    I tested at on page with that code that worked out:

    add_action('admin_enqueue_scripts', 'myPlugin_jcf_admin_fix');
    function myPlugin_jcf_admin_fix(){
      $screen = get_current_screen();
      if ( in_array($screen->id, array('settings_page_jcf_admin', 'settings_page_jcf_fieldset_index')) ) {
        wp_enqueue_script('jquery-migrate');
      }
    }
    Plugin Author Alex Prokopenko / JustCoded

    (@aprokopenko)

    Hi, we will check these issues once we have some bench. I will get back to you once they are fixes

    Same thing happening to me, hijacking thread to see if there’s any fix

    I was having the same problem, there are 2 things that you can do that I have found:
    1) install Enable jQuery Migrate Helper
    2) anywhere that you have jQuery(…).live, change it to jQuery(…).on, for reference check here: https://stackoverflow.com/questions/14354040/jquery-1-9-live-is-not-a-function. I have found that if you are using an element that is being appended, that if you use body as your initial selector that it works well ex. jQuery(‘.test’).live changes to jQuery(‘body’).on(‘event’, ‘.test’, funstion(){});

    • This reply was modified 1 year, 1 month ago by danyg79.
    Plugin Author Alex Prokopenko / JustCoded

    (@aprokopenko)

    Hi everyone, please check new plugin version. We add jquery migrate dependency.

    Thread Starter netzgestaltung

    (@netzgestaltung)

    I tested the update on another page, looks like it works now.

    Thanks for the quick response.

    Br,
    tom

    Plugin Author Alex Prokopenko / JustCoded

    (@aprokopenko)

    Cool, thanks for reporting an issue.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘jQeuery Error “.live is not a function”’ is closed to new replies.