user406151
user406151

Reputation: 425

How to set the selected value for a drop down list based on another drop down list?

If I select x value in the first drop down list, then Y value would be selected on the second drop down list.

Upvotes: 0

Views: 214

Answers (1)

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100175

If you wan it in jQuery then;

$("#yourFirstSelectId").change(function() {
   var firstSelected = $(this).val();
   $("#yourSecondSelectId option:selected").val(firstSelected);
});

Upvotes: 3

Related Questions