select dropdown option from js

Home Forums Quform WordPress select dropdown option from js

This topic is: not resolved
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #35209
    oivanr
    Participant

    Hi,
    I am working in a form that get information of students. In this form I have between another, two select menu (dropdown). The first is about departaments (13_46) and, when I make a choice, populate a second one (13_47) based on the value selected in the first.
    To edit the information I call all the data through an ajax call. The data is displayed inside the proper fields but I have problem with first dropdown (13_46) it doesn’t display the option text.
    I assign the value and I tried to select the option inside a js script. I had use these:
    a) $(‘.quform-field-13_46’).val().prop(‘selected’,true);
    b) $(‘.quform-field-13_46’).filter(value=noDepto).prop(‘selected’,true);
    c) if ($(‘.quform-field-13_46’).val() == noDepto){$(‘.quform-field-13_46’).prop(‘selected’,true)};
    But nothing works.
    I am not able to use the change() option because if I use it the next dropdown (13_47) doesn’t recognize the selected value, The (13_47) is working fine using this:
    d) $(‘.quform-field-13_47’).val(valores[0][‘slg08_MuniNac’]).change();
    Thanks in advance for your help,

    #35210
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy