Move this topic
Using combobox with onchange command
in Using jQuery UI
•
8 years ago
I am unable to use the JavaScript onChange command with comboboxes. The code is on the underlying Select control, but it does not work. If I remove the jQuery that turns the select to the combobox it works.
Is there some work around for this?
Thanks,
1
Replies(6)
Re: Using combobox with onchange command
8 years ago
The combobox
is not a feature of jQuery UI, it is just a demo of what you can do
with autocomplete.
I added a change event that goes back to the select, so you can code
- $( "#combobox" ).combobox().change(function( ) {log($(this).val()) })
Feel free to use and test my version jQuery UI Autocomplete
- Custom Combobox.
JΛ̊KE
Leave a comment on jakecigar's reply
Re: Using combobox with onchange command
8 years ago
I got it working... Thanks!!! - however it appears to execute the
function on blur... which is still ok.
Leave a comment on simonshawca's reply
Re: Using combobox with onchange command
8 years ago
Glad ya like it. I’ve never had to use it, Someone asked last year
how to do some CSS on it, so I got to know the dreaded combobox.
JΛ̊KE
Leave a comment on jakecigar's reply
Re: Using combobox with onchange command
8 years ago
This is probably getting off topic for this forum, but next question... using script, how do I set a selected value for a combobox - I need to do this to set default choice from the item selected in the first combobox.
Leave a comment on simonshawca's reply
Re: Using combobox with onchange command
8 years ago
I never thought about it!
- $("#combobox").val("Asp").combobox("instance").input.val("Asp")
Seems to do it.
JΛ̊KE
Leave a comment on jakecigar's reply
Re: Using combobox with onchange command
7 years ago
I had to add this to the code from the example since it wasn't triggering the change event.
this._on(this.input,
{
autocompleteselect: function (event, ui)
{
ui.item.option.selected = true;
this._trigger("select", event, { item: ui.item.option });
},
autocompletechange: function (event, ui)
{
if (ui.item != null && ui.item != undefined)
{
this._trigger("change", event, { item: ui.item.option });
this._removeIfInvalid();
}
else
{
this._trigger("change", event, { item: this.input[0].value });
}
}
});
Leave a comment on Marbry Hardin's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic
Reply to simonshawca's question
Statistics
- 6 Replies
- 8269 Views
- 1 Followers