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 () {
$("#go").on("click", function () {
var oldSelect = $("#autocomplete").autocomplete("option", "select");
$("#autocomplete").autocomplete({
select: function (event, ui) {
oldSelect.call(this, arguments);
alert("f2NEW = " + $(this).attr("id"))
}
})
$(this).remove()
})
$("#autocomplete").autocomplete({
select: function (event, ui) {
alert("f1 = " + $(this).attr("id"))
},
source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
});
})
</script>
</head>
<body>
<label for="autocomplete">Select a programming language: </label>
<input id="autocomplete">
<input id="go" name="" type="button" value="добавить свою обработку select">
</body>
</html>