Skip to content

Instantly share code, notes, and snippets.

@anak10thn
Created May 16, 2012 19:35
Show Gist options
  • Save anak10thn/2713320 to your computer and use it in GitHub Desktop.
Save anak10thn/2713320 to your computer and use it in GitHub Desktop.
multiple ID
<!DOCTYPE html>
<html>
<head>
<title>attr</title>
<script src="jquery.js"></script>
<script>
$(document).ready(function(){
$('#ganti').attr('href',$('#method').val()+'/'+$('#location').val());
$('#method,#location').click(function(){
var method = $('#method').val();
var location = $('#location').val();
$('#ganti').attr('href',method+'/'+location);
});
});
</script>
</head>
<body>
<select id="method">
<option value="all">Pilih Method</option>
<option value="method-1">Method1</option>
<option value="method-2">Method2</option>
</select>
<select id="location">
<option value="all">Pilih Location</option>
<option value="surabaya">Surabaya</option>
<option value="bali">Bali</option>
</select>
<a id="ganti" href="">silahkan klik</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment