Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
            <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/jquery.selectboxit/3.5.0/jquery.selectBoxIt.css" />
</head>
<body>
  
          <select name="test" id="exampleSelect">
            <option value="SelectBoxIt is:">SelectBoxIt is:</option>
            <option value="a jQuery Plugin">a jQuery Plugin</option>
            <option value="a Select Box Replacement">a Select Box Replacement</option>
            <option value="a Stateful UI Widget">a Stateful UI Widget</option>
          </select>
  
          <select name="test" id="exampleSelect2">
          </select>
            <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
          <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
          <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.selectboxit/3.5.0/jquery.selectBoxIt.min.js"></script>
          <script>
            $(function() {
              
              $('select').selectBoxIt({ autoWidth: false });
              var firstSelectBox = $('#exampleSelect').data('selectBox-selectBoxIt'),
                  secondSelectBox = $('#exampleSelect2').data('selectBox-selectBoxIt');
              
              
              $('#exampleSelect').on('change', function() {
                
                firstSelectBox.remove();
                //This is where you would do your ajax
                secondSelectBox.add([
                  { val: 'test', text: 'test' },
                  { val: 'test1', text: 'test1' },
                  { val: 'test2', text: 'test2' }
                ]);
                
                
              });
            });
          </script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
gregfrankopro
0viewers