I am attaching a callback function to select box on change event like this
select.on('change', config, party.selectOne);
Here config is the parameter I am passing to call back function. Inside call back I could access config parameter.
But my issue is, inside callback, $(this) returns unexpected object other than select box object
party.selectOne= function(config) {
// is the selectbox
var selectbox = $(this);
var api = selectbox.data('api');
}
So I am getting api as undefined. But this will work fine if I don't pass any parameter to call back. What is wrong with me?
Example :
<select data-api="{'name':'one','address':'address1'}">
<option>one</option>
<option>two</option>
</select>