Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <select id="one" onchange="document.getElementById('two').value=value">
  2. <option>Select option</option>
  3. <option >text1</option>
  4. <option>text2</option>
  5. <option>text3</option>
  6. </select>
  7. <select id="two" onchange="document.getElementById('one').value=value">
  8. <option>Select option</option>
  9. <option>text1</option>
  10. <option >text2</option>
  11. <option>text3</option>
  12. </select>
  13.  
  14. <div class="container">
  15.  
  16. <select id="one">
  17. <option>Select option</option>
  18. <option >text1</option>
  19. <option>text2</option>
  20. <option>text3</option>
  21. </select>
  22. <select id="two" >
  23. <option>Select option</option>
  24. <option>text1</option>
  25. <option >text2</option>
  26. <option>text3</option>
  27. </select>
  28. <select id="three" >
  29. <option>Select option</option>
  30. <option>text1</option>
  31. <option >text2</option>
  32. <option>text3</option>
  33. </select>
  34.  
  35. </div>
  36.  
  37. Array.prototype.map.call(document.querySelectorAll('select'),function(element,index,arr){
  38.  
  39. element.addEventListener('change',function(){
  40. var _value = this.value;
  41. Array.prototype.map.call(arr,function(e,i,a){
  42. a[i].value = _value;
  43. })
  44.  
  45. },false)
  46.  
  47. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement