The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Can’t get this simple script to work.

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #41696

    I decided to format my code to a more “standard” and friendly version so I could create options the could be called up at anytime within the HTML documents.

    Check this JS Fiddle document. You’ll see it won’t work, but for the effort of my life, can’t figure out why.

    Depending on jQuery only.

    Working before hand using just Variables:

    Re-written but not working:

    Many thanks if anyone can clear this up. Totally lost in the code right now.

    Also, how would I manage the script with settings through the “Script” HTML tags; for example using

    animSpeed: 500,
    theme: 'blue'

    Happy new year to everyone too!


    Whoops. Edited link in case anyone noticed the “Working” version wasn’t actually working! Ha!

    Taufik Nurrohman

    Press the JSLint button :)


    Still not working, but thanks for that! It helped a lot!

    Taufik Nurrohman

    Still not working, but there are some `thing` that I `think` could be noticed: [](”)

    Here’s a veeeeeeeeeeeerrrrrrrrrrrrrrrrrrrrrryyyyyyyyyyyy simple JQuery plugin pattern, I often use this pattern when creating a plugin:

    (function($) {

    $.fn.pluginName = function(options) {

    // Default options...
    options = $.extend({
    a: '#ff0',
    b: '<button>Aye!</button>'
    }, options);

    return this.each(function() {
    // do something with `$(this)`
    $(this).css('background-color', options.a);




    bgColor: '#080',
    html: '<button>Another Aye!</button>'

    Demo: [](;)

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.