I am trying to create a custom jquery function which has two parameters, the one a single string defining the method in which to update the second parameter; an object of selectors.
Here is an example of the usage of the function:
$.select_content("update", {
"object_1",
"object_2"
});
And the function:
(function ( $ ) {
var methods = {
"update" : function ( objects ) {
$.each(objects, function (object){
// Do stuff...
});
},
"reset" : function ( objects ) {
$.each(objects, function (object){
// Do stuff...
});
}
};
$.fn.select_content = function ( method ) {
};
})( jQuery );
However I get a return error in my console which exclaims a unexpected token , on the this line: "object_1",",.
Is there a better way to approach this? Thank you.