Search code examples
jquerypluginscomboboxonchangelisten

Jquery plugin. Combobox. Event onChange


I have a problem with this plugin http://jquery.sanchezsalvador.com/jquery/page/jquerycombobox.aspx On my page there are a few select boxes, which transformed by jquery.combobox. As far as it's transformed, it has different html like this

<input class="combobox_hidden" type="hidden" name="prtnr" id="prtnr" value="Value">

I read documentation about events in this plugin. I wanna listen to onChange event and do something, but it doesn't work.

var allsels;
var sels = $("select");
if (sels.length)allsels = sels.combobox();
........
allsels.combobox.onChange=function(){....};

What is wrong here?


Solution

  • On the last line, try

    allsels.onChange = function () {...};
    

    I find this documentation confusing, personally:

    usage:

    var elementJQ = $("#id").combobox(); elementJQ.combobox.onChange = function(){};

    or $("#id").combobox().onChange = function(){};

    So the return result of $('#id').combobox() is a combobox object... with a combobox attribute?