So i have two different inputs. First one has all the necessary options set by default but the second one has its options set based on what use chooses in the first one.(lets call them "countries" and "cities").
After Country is selected and its cities are loaded i would like to set value of city. I do it like this:
$('#city_id').val(cityVariable)
but it fails to load everytime. I'm almost sure its because DOM is reloaded but i still dont know how to refresh it properly. Long story short i want to be able to select option out of options downloaded with ajax
UPDATE
to make it more clear i will give you pseudo code ofhow it works
$('#country_id').change ->
///here goes ajax and the options for city select are called
/////here DOM should be refreshed so i can use new options
$('#city_id').val(cityVariable)