Home Forums Backend Issues (wp-admin) jQuery Auto Populate Reply To: jQuery Auto Populate

  • Hi E,

    I have one more question pls, here is my js code:
    What I do here is:

    1. I have 3 different post types where I want to use this auto populate
    2. Every post type has different id for select menu, so I have put their id into variables to make life easier

    3. I get selected value from ‘Select Country’
    4. I do AJAX to get list of areas and cities for that country

    5. I get response as comma seperated (eg: city1,city2,city3)
    6. I do with jquery each:
    $( '#' + selector_area ).append( $('<option></option>').val(text).html(text) )

    This is how I append values as options under my select menu.

    Now everything here works fine, but problem is that saved value is not selected or displayed.
    Every time I refresh ‘Edit posts’ area is not correct so I need to select area every time I edit and save post.

    Any advice please?