⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

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



Guilherme Lofrano Corneto
  • profile picture
  • Member

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?

Fernando Bussmann
  • profile picture
  • Member

Posted 07 May 2015 - 13:12 PM

same problem