Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <select id="sel">     <option>A<option>B<option>C</select>
<a id="go" href="#">Go</a>
  
</body>
</html>
 
(function(){
  var originalJqOn = jQuery.fn.on;
  jQuery.fn.extend({
    onAndFirst: function(evtName,fn) {
      fn();
      this.on(evtName, fn);
    }
  });
})();
var base = "/act/";
var update_go = function (){
  // in first run "this" equals the global window object
  if (this === window) {
    $('#go').prop('href',base+$("#sel").val());
    console.log("href set to: " + $("#sel").val());
  }
  else {
  $('#go').prop('href',base+$(this).val());
  console.log("href cahnged to: " + base+$(this).val());
  }
};
$('#sel').onAndFirst('change',update_go);
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers