Notes by James

Displaying keyword search results 1 - 10
Created by James on May 03, 2012 14:54:46    Last update: May 03, 2012 14:54:46
History.js gracefully supports the HTML5 History/State APIs (pushState, replaceState, onPopState) in all browsers. For HTML4 browsers it will revert back to using the old onhashchange functionality. All major browsers are supported. This is a simple test page to get started: <html> <head> <title>Test History</title> ... Note: state url must be provided for IE to generate a unique hash. YOu can prefix the state url with '?' ('#' does not work).
Created by James on May 02, 2012 13:01:24    Last update: May 02, 2012 13:01:24
Use the .prev() function to find the previous sibling of the current element: $(this).prev() or $(this).prev('.selected')
Created by James on April 25, 2012 08:38:05    Last update: April 25, 2012 08:38:05
With no parameters, the .toggle() method simply toggles the visibility of elements. Example: $(function() { $('body').click(function() { ...
Created by James on April 25, 2012 08:31:13    Last update: April 25, 2012 08:31:13
Use the .is() function to test if an element is visible: if ($('#pop').is(':visible')) { console.log...
Created by James on April 24, 2012 14:01:39    Last update: April 24, 2012 14:01:39
This is the Mathias Bynens placeholder plugin with several bug fixes of my own. /*! http://mths.be/placeholder v2.0.7 by @mathias ...
Created by James on April 24, 2012 13:50:05    Last update: April 24, 2012 13:50:05
The this object can be changed when calling a JavaScript function with func.call(theObject) . This is an example: <!DOCTYPE html> <html> <head> <title>jQu... The JavaScript console logs: [Global log] this is: [object Window] [log.cal...
Created by James on April 24, 2012 13:01:07    Last update: April 24, 2012 13:01:07
The jQuery .add methods adds elements to a set of existing jQuery object collection. For example: $('div').add('span').add('p').each(function() { ... To build a collection from an empty set: $coll = $(); $('li').each(function() { i... Note that .add does not alter the original object, but returns a new object with the added element, so you have to use: $coll = $coll.add(elem); $coll.add(elem) alone does not work! The reverse of .add is .not( elements | selector ) . Or, you can use .end() to return to the collection before you called .add() .
Created by James on February 02, 2012 09:31:03    Last update: February 02, 2012 09:31:03
This is an example that adds a validation rule to jQuery validation: // add a custom method $.validator.addMethod("m...
Created by James on February 02, 2012 09:20:22    Last update: February 02, 2012 09:20:22
This example came from the jQuery validation documentation. The required rule can be used to validate a required selection box when you set the value of the first option to empty. <!DOCTYPE HTML> <html> <head> <scrip... The error message is the title since no error message is specified. A more fully defined validation check would look like this: $('#my-form').validate({ errorElement: "p", ...
Created by James on January 30, 2012 10:39:33    Last update: January 30, 2012 10:39:33
The qTip tooltip hides when mouse is off the target but on the tooltip itself. This makes it hard to click links in the tooltip - when you try to click the link, it disappears. Add the " fixed: true " flag to prevent it from disppearing: <script type="text/javascript"> $(function() { ...
Previous  1 2 3 4 5 6 7 Next