I am having some trouble with elements being outside scope or something but I am not getting any errors so I am not really sure how to fix it. I've shrunk up my code below to include what is relevant.
(function(){
var zdf = {
theme : $('#zdf_theme')
};
zdf.setupPopup = function(){
zdf.loadThemes();
}
zdf.loadThemes = function() {
zdf.theme
.editableSelect({
effects: 'slide'
})
.on('select.editable-select', function(e, li) {
zdf.theme.attr("data-value", li.attr('value'));
});
});
}
}();
Hopefully I've provided enough code to identify the problem but basically everything is working up until the line
zdf.theme.attr("data-value", li.attr('value'));
It doesn't seem to select the object zdf.theme
If I replace it with the actual selector $('#zdf_theme')
it works fine.
The editable select is this code base https://github.com/indrimuska/jquery-editable-select
Any input would be great!