change selects value onchange of another select

Posted by Syom on Stack Overflow See other posts from Stack Overflow or by Syom
Published on 2010-05-29T12:14:57Z Indexed on 2010/05/29 12:42 UTC
Read the original article Hit count: 166

Filed under:

i start learning jquery few days ago, and i like it very much. but now i have a problem, that can't solve alone.

i have two selects

<select id="select1">
  <option value="1">1day</option>
  <option value="2">2day</option>
  <option value="3">3day</option>
</select>

<select id="select2">
  <option value="1">1day</option>
  <option value="2">2day</option>
  <option value="3">3day</option>
</select>

i need to set #select2 the same value with #select1, when #select1 changes

i've red some questions about select tag here, but i need to set "selected" attribute to that option, which have the same value. how can i do it?

Thanks

© Stack Overflow or respective owner

Related posts about jQuery