Support

Account

Home Forums Front-end Issues How do I access the JQuery object found in $field value

Helping

How do I access the JQuery object found in $field value

  • In an action like so: acf.add_action('select2_init', function( $input, args, settings, $field ) the $field value contains an object holding the current element and inside that object there is a key that looks like this:
    JQuery35100094061739408837222: {type: 'post_object', key: 'field_61d59682129cf', name: 'course_teaser_course', acf: n}

    I need to find the acf-key in there, but how do I get it, since I don’t know hash added after JQuery?

    I actually need the $field.next()[0].JQueryxxx.acf because I can’t seem to find a way to get the value from a dynamically filled Select-list (not select2).

    Any help?

  • I turned out I couldn’t use it anyway, so don’t bother this issue 😊
    I did manage to get the info I (thought I) was looking for by looping through the keys

    
    Object.keys($input).forEach(key=>{console.log($input[key])})
    

    In case anyone would wonder.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.