Recent Notes
Displaying keyword search results 1 - 4
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 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 January 10, 2011 16:37:20
Last update: January 10, 2011 16:37:20
The following page injects CSS rules with JavaScript. It works fine in Firefox and Chrome.
<html>
<head>
<script type="text/javascrip...
But in IE, it breaks with "Unknown runtime error" (seemed like it's trying to interpret the curly brackets in the CSS as JavaScript blocks!):
In order to make it work in IE, the code need to be changed to:
<html>
<head>
<script type="text/javascrip...
The tricks to identify IE and insert new CSS rules came from Paul Irish .
Created by Dr. Xi on January 30, 2009 16:57:12
Last update: January 30, 2009 17:25:36
The scriptable attribute defaults to false . However, even when you set it to true , there is a time delay between when the applet is loaded and when it becomes scriptable . The following code may fail:
<html><body>
<object classid="clsid:8AD9C840-04...
You need to wrap the JavaScript like this:
<script language="JavaScript" type="text/javascrip...