JSFiddle

  • jQuery htmlOf plugin

    http://benalman.com/

    // seriously, why isn't this in core?
    (function($) {
    
      // chaining = winning
      $.fn.htmlOf = function(target) {
        $(target).empty();
        return this.appendTo(target ...
  • Duck Punching jQuery UI Dialog #27 is the latest revision

    Allows modal to accept a selector in addition to the standard boolean value. If a selector is passed, the overlay is appended to it, instead of the body element.

    $(function(){
      // button for added effect and hawt-ness
      $('a').button();
        
      var $overlay = $( 'input[type="checkbox"]' ),
          $ul = $( '#foo' ),
          handleOverlay = function(e,ui ...
  • Duck Punching jQuery UI Dialog

    Allows modal to accept a selector in addition to the standard boolean value. If a selector is passed, the overlay is appended to it, instead of the body element.

    $(function(){
      // button for added effect and hawt-ness
      $('a').button();
    
      // standard jQuery UI Dialog
      $('#dialog').dialog({
        autoOpen: false,
        width: 600,
        buttons ...
  • jQuery Wrap Google Ad Bug

    This is a demonstration of what happens when you attempt to wrap a Google ad using jQuery.

    console.log( 'Page has loaded' );
    jQuery("button").click(function (){
           $("#a").wrap('<div class="wrapped"></div>');
        });
  • Modified Sortable #7 is the latest revision

    Html/css borrowed permanently from the Sortable Demo on jqueryui.com :p

    // save the old _mouseStop function
    var _mouseStop = $.ui.sortable.prototype._mouseStop;
    
    // now lets make a new one
    $.ui.sortable.prototype ...
  • Regular Ol' Sortable #8 is the latest revision

    Borrowed permanently from the Sortable Demo on jqueryui.com :p

    $('#sortable').sortable().disableSelection();
  • Subclassing woes #2 is the latest revision

    How assigning to $ before making a subclass isn't working

    // assign something to $
    $.somethingRandom = "omg my jqueries";
    
    // make our subclass
    $sub = $.subclass();
    
    console.log( '$ test' );
    console.log( '$.somethingRandom: ',  $.somethingRandom );
    console ...
  • Subclassing woes #1 is the latest revision

    How assigning to $ before making a subclass isn't working

    // assign something to $
    $.somethingRandom = "omg my jqueries";
    
    // make our subclass
    $sub = $.subclass();
    
    console.log( '$ test' );
    console.log( '$.somethingRandom: ',  $.somethingRandom );
    console ...
  • Subclassing woes #1 is the latest revision

    How assigning to $ before making a subclass isn't working

    // assign something to $
    $.somethingRandom = "omg my jqueries";
    
    // make our subclass
    $sub = $.subclass();
    
    console.log( '$ test' );
    console.log( '$.somethingRandom: ',  $.somethingRandom );
    console ...
  • jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.

    http://benalman.com/ https://gist.github.com/661855

    function log_fn( msg ){
        return function (){
            $('body').append( '<br/>' + msg );
        }
    };
    
    function br() {  log_fn('')(); };
    
    $.subscribe( 'foo', log_fn( 'foo' ) );
    $.subscribe( 'foo.bar', log_fn( 'foo ...</br/>
  • jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.

    http://benalman.com/ https://gist.github.com/661855

    function log_fn( msg ){
        return function (){
            $('body').append( '<br/>' + msg );
        }
    };
    
    function br() {  log_fn('')(); };
    
    $.subscribe( 'foo', log_fn( 'foo' ) );
    $.subscribe( 'foo.bar', log_fn( 'foo ...</br/>