Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <ul id="selector">
    <li><a href="#" data-target="o1">select 1</a></li>
    <li><a href="#" data-target="o2">select 2</a></li>
    <li><a href="#" data-target="o3">select 3</a></li>
  </ul>
  <select id="s">
    <option></option>
    <option id="o1">1</option>
    <option id="o2">2</option>
    <option id="o3">3</option>
  </select>
  
  <script>
    $('#selector a').click(function() {
      $("#s").find("#" + $(this).data("target")).attr("selected", true);
    });
  </script>
</body>
</html>
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers