So I want to make myself a Jquery plugin, you something dynamic I can use again and again over projects. I'm already locally serving the latest jquery library version(jquery-2.1.4.min.js) and then linking my plugin. like this..
<head>
other code resources and meta...
<script type="text/javascript" src="/js/libs/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="/js/functions.jquery.js"></script>
<script type="text/javascript" src="/js/green.js"></script>
</head>
inside the '/js/green.js' i have the following code(Which I got off the web by the way).
(function ( $ ) {
$.fn.greenify = function( options ) {
// This is the easiest way to have default options.
var settings = $.extend({
// These are the defaults.
color: "#556b2f",
backgroundColor: "white"
}, options );
// Greenify the collection based on the settings variable.
return this.css({
color: settings.color,
backgroundColor: settings.backgroundColor
});
};
}( jQuery ));
My HTML document contains the following code..
$( "div" ).greenify({
color: "orange"
});
I just don't understand why nothing is happening. To the color of all 'div' elements. Can anyone shed some light on what the bug might be?? Thanks in advance.