Recent Notes

Displaying keyword search results 1 - 6
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 Fang on November 28, 2011 21:04:15    Last update: November 28, 2011 21:04:15
Some innocent looking JavaScript may cause a fatal error in a Facelet page. For example: <script type="text/javascript"> if (items.lengt... or <script type="text/javascript"> // jQuery code ... Because Facelet is strict XML, therefore, < and > must be escaped. There are several ways to deal with this: Do not embed JS code directly in the page. Put the code in .js files and include it in the page with the src attribute. Put JS code in a CDATA section: <h:outputScript target="head"> <![CDATA... Use XML entities: <script type="text/javascript"> // jQuery code ...
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 April 04, 2011 19:41:51    Last update: April 04, 2011 19:41:51
Use the nodeName attribute to get the name of the HTML tag, tagName is not recommended . <!DOCTYPE html> <html> <head> <title>jQu...
Created by James on July 04, 2009 16:30:40    Last update: January 11, 2011 21:21:59
If you are looking for a solution for a progress bar, I direct you to the following resources: Bare Naked App provides a simple and elegant solution based on pure CSS with two images. You control the percentage of completion through the background-position attribute of the CSS. HTML: <img src="/images/percentImage.png" alt="... CSS: img.percentImage { background: white url(/imag... Images: (percentImage.png) (percentImage_back.png) WebAppers extended the above solution with JavaScript. They also added several colored images: JQuery UI has a built-in progress bar widget. However, if you want to get to understand some of the foobar needed to get CSS to work (in general) through this example, stay with me for the rest of this note. Initially I was thinking, a progress bar should be easy: just make...
Created by James on January 04, 2011 16:22:43    Last update: January 05, 2011 13:43:06
The jQuery doc says: If you wish to use any of the meta-characters (such as !"#$%&'()*+,./:;?@[\]^`{|}~ ) as a literal part of a name, you must escape the character with two backslashes: \\ . So what are these meta-characters ? According to the CSS specification : In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_); These meta-characters are the printable characters in the ASCII but outside the range allowed by CSS identifiers. They must be escaped, with two backslashes. Why two backslashes? Because one backslash is consumed by JavaScript, and with only one backslash in place, no backslash is passed to jQuery...