I am trying to use this jQuery code in my program: http://jqueryui.com/demos/autocomplete/#combobox
Basically this is a combo box that has an autocomplete field and a drop-down button.
When I try to use my combo box inside the form tags, it does not work properly - the drop-down list button keeps sending the form when I just want to search for the values.
The source code from the example is as follows:
$( "<button> </button>" )
.attr( "tabIndex", -1 )
.attr( "title", "Show All Items" )
.insertAfter( input )
.button({
icons: {
primary: "ui-icon-triangle-1-s"
},
text: false
})
.removeClass( "ui-corner-all" )
.addClass( "ui-corner-right ui-button-icon" )
.click(function() {
if ( input.autocomplete( "widget" ).is( ":visible" ) ) {
input.autocomplete( "close" );
return;
}
input.autocomplete( "search", "" );
input.focus();
});
Any help appreciated :).
source
share