Skip to content

Instantly share code, notes, and snippets.

@javierguerrero
Created February 24, 2015 15:59
Show Gist options
  • Save javierguerrero/87a336ce0ea26becec11 to your computer and use it in GitHub Desktop.
Save javierguerrero/87a336ce0ea26becec11 to your computer and use it in GitHub Desktop.
<input type="radio" name="choice" value="1">choice1
<input type="radio" name="choice" value="2">choice2
<br />
<input id="autocomplete">
var availableTags1 = [
"ActionScript",
"AppleScript",
"Asp"
];
var availableTags2 = [
"Python",
"Ruby",
"Scala",
"Scheme"
];
$( "#autocomplete" ).autocomplete({
source: availableTags1
});
$('input[name="choice"]').click(function(){
if(this.checked){
if(this.value == "1"){
$( "#autocomplete" ).autocomplete('option', 'source', availableTags1)
} else {
$( "#autocomplete" ).autocomplete('option', 'source', availableTags2)
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment