function select2_search($el, term) {
$el.select2('open');
// Get the search box within the dropdown or the selection
// Dropdown = single, Selection = multiple
var $search = $el.data('select2').dropdown.$search || $el.data('select2').selection.$search;
// This is undocumented and may change in the future
$search.val(term);
$search.trigger('keyup');
}
$('button').on('click', function () {
var $select = $($(this).data('target'));
select2_search($select, 'Arizona');
});
$("#hotelcityto").autocomplete({
source: "search.php"}).autocomplete( "instance" )._renderItem = function(ul, item) {
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a><strong class='ui-item-name'>" + item.label + "</strong>, <span class='ui-item-country'>" + item.country + "</span>"+ (item.state ? ", " + item.state : "") +" <span class='ui-item-kolvo'>" + item.kolvo + "</span></a>")
.appendTo(ul);
};