Notes by James

Displaying keyword search results 1 - 10
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 13, 2012 11:46:33    Last update: February 13, 2012 11:46:33
The jquery property of a jQuery object contains the jQuery version number. You can: Use it to identify a jQuery object: if ( a.jquery ) { alert(' a is a jQuery obj... Get the version number of jQuery: // this works alert( 'You are running jQuery ve...
Created by James on February 02, 2012 16:09:05    Last update: February 02, 2012 16:09:17
flowplayer is another way to embed Flash in a web page. The code looks like this: <object width="6400" height="380" data="swf/flowpl... You need to download two swf files: http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf http://releases.flowplayer.org/swf/flowplayer.controls-3.2.0.swf
Created by James on February 02, 2012 16:00:15    Last update: February 02, 2012 16:00:15
Video for Everybody seems to be a generic way to embed video in a web page, even without flash. This code snippet comes from that site. <!-- first try HTML5 playback: if serving as XML, ...
Created by James on September 03, 2010 15:52:12    Last update: January 11, 2011 20:22:40
Use the siblings function to find all siblings of the current jQuery object: $(this).siblings() which is equivalent to: $(this).parent().children().not(this) Or, use an optional selector to further limit the selection of siblings: $(this).siblings('li .hilighted') Test page: <!DOCTYPE html> <html> <head> <title>jQu...
Created by James on January 10, 2011 11:10:32    Last update: January 10, 2011 11:11:00
Following is the code snippet to embed a Flash swf file in a web page. The OBJECT tag is for IE, while the EMBED tag works for Firefox. <HTML> <HEAD> <TITLE>Embed flash video in ...
Created by James on October 21, 2010 19:48:36    Last update: October 21, 2010 19:50:43
Use the in operator to enumerate over an object's properties: Use the in operator to list all properties of an object Call the hasOwnProperty function to determine if the property is a direct attribute of the current object, i.e., not some attribute defined somewhere up the prototype chain. Test code (copy and paste to the JavaScript Executor ): function BaseClass() { this.p1 = 'parent.p1... Note that intrinsic attributes such as constructor , prototype are not listed by the in operator.
Created by James on October 13, 2010 18:16:08    Last update: October 13, 2010 18:16:08
From jQuery doc : The .data() method allows us to attach data of any type to DOM elements in a way that is safe from circular references and therefore from memory leaks. We can set several distinct values for a single element and retrieve them later: $('body').data('foo', 52); $('body').data('bar'... It must be emphasized that the data is associated with the DOM object, not the jQuery object: var a = $('div label'); var b = $('div label');... The above usage is just a shorthand for jQuery.data(domElement, key) .
Previous  1 2 Next