Created
February 24, 2015 15:59
-
-
Save javierguerrero/87a336ce0ea26becec11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type="radio" name="choice" value="1">choice1 | |
<input type="radio" name="choice" value="2">choice2 | |
<br /> | |
<input id="autocomplete"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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