good day,
i writing first jquery plugin. grabbed code learn jquery website. here html javascript:
<div>hello world</div> <br> <br> <div>hola mundo</div> <a href="http://www.nbcnews.com">my link</a> <script src="js/jquery-1.9.1.min.js"></script> <script src="js/jquery.greenify.js"></script> <script> $(function() { $('div').greenify({ text: "hola", color: "#ff0000" }); }); and here jquery.greenify.js:
(function($) { $.fn.greenify = function( options ) { // easiest way have default options. var settings = $.extend({ // these defaults. text: "somewhere in time", color: "#556b2f", backgroundcolor: "white" }, options ); return this.each(function() { $(this).text(settings.text); if (settings.color) { $(this).css('color', settings.color); } if (setting.backgroundcolor) { $(this).css('background-color', settings.backgroundcolor); } }); }; }( jquery )); for whatever reason, don't see changes taking effect. have checked console , there no errors. tried set breakpoints return this.each in jquery.greenify.js see if code being executed , it's not. downloaded similar example github https://github.com/taupecat/jquery-plugin does work. i've tried model code after , i'm still not having luck.
i'm hoping set of eye catch i'm missing.
i've checked couple of other question on site, answers didn't pertain issue.
tia,
coson
at end of javascript, add closing
</script> cheers
Comments
Post a Comment