DmitryK1,
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>autocomplete demo</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script>
$(function ()
{
$.widget("my.idautocomplete", $.ui.autocomplete, {
options: {
id:"",
select:function f1(event, ui) { alert("f1")
//this.options.id=ui.id вроде нет никаких this.options ???
console.log("Autocomplete sel " + $(this).attr("id"));
var sel = $( this ).idautocomplete( "option", "sel" );
sel && sel()
}
}
})
$( "#autocomplete" ).idautocomplete({sel:function (){alert(1)} ,
source: [ "c++", "java", "php", "coldfusion", "javascript", "asp", "ruby" ]
});
})
</script>
</head>
<body>
<label for="autocomplete">Select a programming language: </label>
<input id="autocomplete">
</body>
</html>