Is it possible to create a mixin for a jQuery selector (please note, I don’t need no plugins, they are just too bulky for what I’m doing)?
Here’s the task I’m trying to accomplish:
// Given a div I need to paint it with green for which...
var $container = $("#id001");
// current solution
var do = function(e) {
var container = e.container;
container.css("backgroudColor", "green");
};
do({ container: $container }); // call
// desired solution
var do**Mixin** = function(e){
e.css("backgroudColor", "green");
};
container.do(); // call
I know you said you don’t need a plugin, but a plugin for what you need is very simple:
Use:
Untested, but….pretty sure it should work as is.
Fiddle (courtesy of Jamiec):
http://jsfiddle.net/mPu6X/