Jump to content


Dependent dropdown don't allow to change a select value using jquery

dependent dropdown dropdown jquery select

  • Please log in to reply
1 reply to this topic

#1 Guilherme Lofrano Corneto

Guilherme Lofrano Corneto

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 06 May 2015 - 12:20 PM

Hello everyone, I`m using dependent dropdown Gc librarie exaclty as example of the librarie does, and it`s working fine. But when I was tryng to make a jquery to change the current value of the select, it doesen`t work.
     About structure: I have a main select that contains categories, and when I select one category another sub select opens with the respective subcategories. Until here it`s fine.
About the problems: I would like to start my select in the first position, so i did a jquery like this:
Obs.: select name: 'field-Cat_Codigo'
$(document).ready(function(){
     $("#field-Cat_Codigo").val(1);
});
 
But it doesen't work. It works fine to normal dropdowns, but not for dependent ones. So I tried a lot of things like this in differents order of trials as: 
$("#field-Cat_Codigo").trigger("liszt:updated");
$("#field-Cat_Codigo").val(1).trigger('change');
$("#field-Cat_Codigo").val(1).change();  
$("#field-Cat_Codigo").change(); 
 
In other application i did it, but when I need to change the sub dropdown I got the same error. So the thing is, How can I change both selects using jquery ?
 
Any idea?


#2 Fernando Bussmann

Fernando Bussmann

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 07 May 2015 - 01:12 PM

same problem







Also tagged with one or more of these keywords: dependent dropdown, dropdown, jquery, select

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users