Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
<link class="jsbin" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
  </head>
  <body>
    
    <select id="country"><option value="">Choice one</option><option value="1">US</option><option value="2">UK</option></select>
        <form id="aspnetForm" action="" method="post">
          Type "A" to test:
      <input type="text" id="city" >
        </form>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"></script>
  </body>
</html>
 
$(function() {
  var data = [];
  var US= ["City1", "City2", "City3"];
  var UK= ["UK_City1", "UK_City2", "UK_City3"];
  $("#city").autocomplete({
    source: function(t, c) {
      var src = $('#country').val() == '1' ? US: UK;
      c(src);
    }
  });
});
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers