piraids
piraids

Reputation: 13

Adding callback for change event in jQuery plugin dropdown.js

Using this SimpleDropDownEffects plugin for jQuery, when the selected value is changed, how do I add a callback?

I'm looking for something on the lines of 'onChange'.

$.DropDown.defaults = {
    onChange: false,
}

ok, what next? plug-in have a function of the click to the option:

this.opts.on( 'click.dropdown', function() {
    // Not executed.
}

Upvotes: 1

Views: 930

Answers (1)

ebilgin
ebilgin

Reputation: 1252

You can do it with

$('#cd-dropdown').dropdown({
    gutter: 5,
    onOptionSelect: function(dom) {
        var value = $(dom).attr("data-value")
        console.log(dom, value);
    }
});

as you can see every change it logs created element from select and values of it.

Upvotes: 1

Related Questions