Recent Notes
Displaying keyword search results 1 - 10
Created by Fang on January 16, 2012 19:32:20
Last update: January 16, 2012 19:32:54
You can submit a form via Ajax by the jQuery Form Plugin . There are two main methods:
ajaxForm : prepares a form for Ajax submit.
Example:
$('#myFormId').ajaxForm({
target: ...
When the form is submitted, it is sent via Ajax.
ajaxSubmit : submit a form via Ajax.
Example:
$('#myForm2').submit(function() {
// i...
jQuery Form Plugin is not in the core jQuery API, so you have to include an additional JS file:
<head>
<script type="text/javascript" ...
Created by James on October 25, 2011 19:44:30
Last update: October 25, 2011 19:45:40
jQuery automatically maps HTML5 custom data attributes to data storage associated with the data() method. Here's an example:
<html>
<head>
<script type="text/javascript"...
Created by James on March 07, 2011 15:49:11
Last update: March 07, 2011 15:49:11
The JavaScript string match method matches the string against a regular expression and returns the matches.
// returns ['av']
'The JavaScript string ma...
Created by James on October 11, 2010 19:01:28
Last update: January 11, 2011 20:38:56
Test page (click the "new window" icon to see the transition):
<!DOCTYPE html>
<html>
<head>
<title>jQu...
Created by James on October 11, 2010 18:14:41
Last update: January 11, 2011 20:36:01
Test page:
<!DOCTYPE html>
<html>
<head>
<title>jQu...
Documentation:
UI/Effects - jQuery JavaScript Library
Effects - jQueryAPI
Created by James on October 25, 2010 04:45:59
Last update: October 25, 2010 04:45:59
The test method for JavaScript regular expression tests if a string matches the regular expression. Below are some examples:
/son/i.test('Jack Jake Jason'); // true
/ja/.te...
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) .
Created by James on October 12, 2010 16:17:05
Last update: October 12, 2010 16:18:31
The splice method cuts elements from an array, and returns the cut-off elements as a new array.
a = [1, 2, 3, 4, 5, 6, 7];
b = a.splice(1, ...
Created by James on October 12, 2010 15:48:29
Last update: October 12, 2010 15:48:29
The pop method removes an element from the end of an array; the shift method removes an element from the beginning of an array:
a = [1, 2, 3, 4];
a.pop(); // 4
a.shift(); /...
Created by Dr. Xi on September 11, 2008 23:06:18
Last update: October 06, 2010 03:16:13
Firefox and Google chrome has native support for the trim function for a String. IE (as of IE 8.0) does not provide a trim function for String. Using the JavaScript Executor , if you execute:
'abcd '.trim
you get:
function trim() { [native code] }
in Firefox and Google Chrome. But you get nothing in IE. If you try to execute the trim method on a String:
'abcd '.trim()
you get this in IE:
TypeError: Object doesn't support this property or...
In order to have the trim function across all browsers, define this function:
if(typeof String.prototype.trim !== 'function') {
...
Or, if you use jQuery, you can use $.trim()