jquery - Select a value after an input select is populated dynamically with change event -


i have 2 inputs select, second 1 populates when 1 value selected @ first input select, works.

i'm selecting value dinamically , second select populating, problem comes when want select option second input select. can't it.

the ajax executing in other file can't modify ajax, want select option dinamically when value appear @ dom.

 <script>     jquery($).ready(function(){        //here i'm selecting option land , region populating        jquery("#land option[value={value1}]").attr("selected","selected").change();         //when try select region dinamically doesn't work        jquery("#region option[value={value2}]").attr("selected","selected").change();      });  </script> 

i want select value second input.

i seems value isn't there,

maybe using event handler, solve it. how can solve porblem?

this sample ajax function based off of first select, select make of car, makes call database , returns options of second option

$("#make").change(function(){     $("#model").attr("disabled", false);     $.ajax({         url: "http://website.com/vehicle/getmodel.php",         data: {make: $(make).val()},         type: "post",         success: function(msg){         $("#model").html(msg);         }     }); }); 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -