Javascript

jQuery On, Delegate, Live, Bind comparisons

Here is a nice article addressing the pros and cons of jQuery .bind .delegate .live and .on. It also shows how in jQuery 1.7.1+ they all map to .on

http://www.elijahmanor.com/2012/02/differences-between-jquery-bind-vs-li...

Adding these comparisons do I don't have to go look them up each time

/* The jQuery .bind(), .live(), and .delegate() methods are just one
   line pass throughs to the new jQuery 1.7 .on() method */

Javascript tracer function

This is a handy little function that can be used for debugging in Drupal. SInce console.log can sometimes break some browsers without a console, this at least makes sure the console.log is only run when you are logged into the site. It also has a nice feature of including the name of the function that called it.

Cookie check to see if cookies are enabled

One difficult aspect of cookies is determining if they are blocked or not when loading a single page. (for example trying to determine whether someone is the first time visitor to a page or repeat visitor with cookies disabled.)

Here is a nice php technique for testing whether cookies are enabled or disabled

<?php
session_start
();

Javascript GET

A quick non-library way to safely look for a GET value and do something with it.

online json editor and js beautifier

When debugging Ajax call returned Jason data this is very useful makes the data easier to read.

http://www.jsoneditoronline.org/

Beautifying javascript  

http://jsbeautifier.org/

Subscribe to RSS - Javascript