I'm working on a project that uses the X-editable library with Bootstrap 3. Throughout the page are multiple instances of the plugin, however, there was a need for some instances to have a different template. By reading the library's documentation I have found that I can make the changes through:
$.fn.editableform.buttons
However, this affects all other X-editable pages. My question here is how can I make this modification only for certain instances. Here's how to extend this plugin and change this default behavior, being referenced as something like this:
$(selector).customEditable();
I do not really know much about jQuery, what I have so far is this:
(function($){
$.fn.customEditable = function(options) {
// var defaults = {
editableform = {
buttons: '<button type="button" class="btn btn-primary btn-sm editable-trigger"><i class="glyphicon glyphicon-edit"></i></button>',
}
// };
var options = $.extend({}, editableform, options);
//Here you can create your extended functions, just like a base plugin.
return this.each(function() {
//Execute your normal plugin
$(this).editable(options);
console.log('customEditable');
});
};
})(jQuery);
But I still can not do the editableform.buttons overwrite for this custom plugin!