JSFiddle

  • events in a for loop

    Events in a for loop with closures

    var txtcolors = ['red', 'blue', 'green'],
      row = document.getElementById('row1'),
      clickCell = row.children,
      i,
      image = document.getElementById('image'),
      modal = document.getElementById ...
  • Facebook Small Message #1 is the latest revision

    Tired of that facebook thing where the messages are big and bold? Fret no more.

    <h1>Need a zero-width space on your clipboard?</h1>
    
    <p>1. Put your cursor into the next box and then Select All.  It ...</p>
  • Default Parameter Assignment

    Efficient way of assigning default values in functions

    // global default values, and other parameters to pass into MyFunct
    var myDefaultObj = {id:987},
        myP1 = ["abc",123],
        myP2 = {id:"foo ...
  • Asynchronous Dialogs with Noty

    Promise implementation and publish/subscribe pattern in javascript

    <h1>Asynchronous Dialogs with Noty</h1>
    <p>One of the problems with going from the LotusScript ui programming to Javascript programming, particularly with ...</p>
  • Closure Example

    How closures hide stuff for you

    $(document).ready(function(){
        $("#btnClosure").click(function(){
    var personFactory = function(fn, ln,age){
    	// this function has a local variable named _person ...
  • Pure CSS rating widget

    No-Library (pure JS), HTML, CSS, JavaScript

    <!-- kudos to Lea Verou http://jsfiddle.net/user/leaverou/fiddles/ -->
    <h3>Employee Rating</h3>
    <p>Overall this employee's star rating is:
    <fieldset class="rating">
        <legend>Please rate:</legend>
        <input type="radio" id="star5" name="rating" value="5" /><label for="star5" title="Rocks!">5 stars</label>
        <input type="radio" id="star4" name="rating" value="4" /><label for="star4" title="Pretty good">4 stars</label>
        <input type="radio" id="star3" name="rating" value="3" /><label for="star3" title="Meh">3 stars</label>
        <input type="radio" id="star2" name="rating" value="2" /><label for="star2" title="Not very good">2 stars</label>
        <input type="radio" id="star1" name="rating" value="1" /><label for="star1" title="Sucks big time">1 ...</label></fieldset></p></!-->
  • Ajax and JSON with jQuery

    Gets JSON data via Ajax server call

    $(document).ready(function () {
    
        $("#btnGetJSON").click(function (e) {
            e.preventDefault();
    
            $.getJSON("https://gist.githubusercontent.com/billwheaton1715/0bbb615afb93143b1dcc/raw/54e1393300e39a084fd129143eef002bd331f7cc/jsonfile", function ...
  • Classes Constructors and Prototypes

    How to make classes in javascript

    var mySmallObject = {
        name: "Small Thing",
        sayName: function () {
            alert(this.name);
        }
    };
    
    // this is the polar coordinate class it takes the distance ...
  • Nested Functions as Closures Neatened

    jQuery 2.1.3, HTML, CSS, JavaScript

    // In javascript, functions are data just like any other value.  Array, Object, String, RegExp, Date etc., and primitive types, boolean ...
  • Nested Functions as Closures

    No-Library (pure JS), HTML, CSS, JavaScript

    // In javascript, functions are data just like any other value.  Array, Object, String, RegExp, Date etc., and primitive types, boolean ...