3

I have 2 drop down lists and I would like to make it so that when someone selects for example value 2 from dropdown1, dropdown2 is automitacally changed to value 2. Is this possible using jquery?

<select id="dropdown1">
 <option value="1">Item1</option>
 <option value="2">Item2</option>
 <option value="3">Item3</option>
</select>

<select id="dropdown2">
 <option value="1">Item1</option>
 <option value="2">Item2</option>
 <option value="3">Item3</option>
</select>
2
  • Consider fixing the typo: dropdWOn1 should be dropdOWn1 Commented Nov 9, 2012 at 17:39
  • I made the change and it's waiting for approval... Commented Nov 9, 2012 at 17:52

1 Answer 1

8

This should do it:

$("#dropdwon1").change(function(){
    $("#dropdwon2").val($(this).val());
});

working version here: http://jsfiddle.net/xkT3U/

Sign up to request clarification or add additional context in comments.

1 Comment

@hunter is it possible to make click on second drop down after change event. I tried with ** $("#dropdwon1").change(function(){ $( "#dropdwon2" ).focus(); $( "#dropdwon2" ).click(); });** but it didn't work .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.