Demo of enable & disable method for Autocomplete in JQuery UI

Method


Change to enable or disable method to see the effect on autocomplete .

source: [ "PHP", "JQuery", "JavaScript", "HTML", "ASP", "Perl", "MySQL","Access","Excel","Dot Net" ],

HTML

<input id=auto_c>
<div class='radio-inline'>
  <label><input type='radio' name='r1' id='r1' value='enable'>enable</label>
</div>
<div class='radio-inline'>
  <label><input type='radio' name='r1' id='r2' value='disable' >disable</label>
</div>

jquery

<script>
$(document).ready(function() {
////////////////
$( "#auto_c" ).autocomplete({
  source: [ "PHP", "JQuery", "JavaScript", "HTML", "ASP", "Perl", "MySQL","Access","Excel","Dot Net" ],
  minLength:0
});
///////////////
$("input:radio[name=r1]").click(function() {
var sel=$(this).val()
	$( "#auto_c" ).autocomplete( sel );
})
////////
})
</script>