JQuery速查表
http://www.gbsou.com/jquery-fact-sheet
http://docs.jquery.com/Main_Page
http://api.jquery.com/
http://visualjquery.com/
http://interface.eyecon.ro/
http://tablesorter.com/docs/
jquery min lite pack各版本的说明:
引用
jquery min lite pack各版本的说明:
jquery.js 全功能未压缩 开发者使用
jquery.lite.js [lite英文是精简版 未压缩 将注释去掉]
jquery.min.js [min 英文最小版 精简版的压缩]
jquery.pack.js [全功能有压缩,]
pack压缩表示:浏览器及服务器端支持gzip 这样下载速度会很快.
jQuery对象和DOM对象的相互转换:
http://www.cnblogs.com/z-yy/archive/2012/07/17/2594963.html
http://www.cnblogs.com/ycbk/archive/2011/02/28/1967242.html
jquery的$("#formId").validate()里rules所指定的为element元素的name属性。
jQuery Selectors:
http://api.jquery.com/category/selectors/
引用
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: \\. For example, if you have an element with id="foo.bar", you can use the selector $("#foo\\.bar").
页面有如下element:
<textarea name="fidsTextRefChannel.textFull" id="fidsTextRefChannel.textFull" rows="7" style="width:100%"></textarea>
为什么使用
$("#fidsTextRefChannel.textFull")
时得不到该element?这与jquery的选择器Selector有关:
$("#id")是 ID Selector:
http://api.jquery.com/id-selector/
$(".myClass")是Class Selector:
http://api.jquery.com/class-selector/
所以,当你使用 $("#fidsTextRefChannel.textFull") 时,jquery会认为
You are trying to access the #fidsTextRefChannel with a class textFull。
解决办法:
一 使用双反斜杠对id中的dot做转义:
$("#fidsTextRefChannel\\.textFull")
二 使用Attribute Equals Selector:
$("textarea[id='fidsTextRefChannel.textFull']")
#(hash) .(dot) 外其他常用的选择器:
空格(blank) : Descendant Selector
http://api.jquery.com/descendant-selector/
Help understanding JQuery Attribute Equals Selector:
http://stackoverflow.com/questions/3814966/help-understanding-jquery-attribute-equals-selector
引用
This selector:
$('#myid .two td[role=foo]')
means: find the element with ID "myid". From it find all descendants with a class of "two". From those elements find all descendants <td> elements that have a role attribute with a value of "foo".
$(document).ready 和 $(window).load 的区别:
Daily Tip : Difference between $(document).ready and $(window).load in jQuery:
http://web.enavu.com/daily-tip/daily-tip-difference-between-document-ready-and-window-load-in-jquery/
$(document).ready vs. $(window).load:
http://4loc.wordpress.com/2009/04/28/documentready-vs-windowload/
jQuery Validation Plugin:
http://stackoverflow.com/questions/4936221/jquery-validate-plugin-on-div
引用
The validation plugin is (currently) designed to work on a <form>,
and only on a <form>.
因为jquery的validation只能针对form,那对分组验证(即页面需要一步一步点击“下一步”,最后做提交)该怎么做那?一种解决思路如下:
http://www.cnblogs.com/wangjq/archive/2011/03/13/1983024.html
或者:(待以后细看补充 ; search key:jquery individual validate)
http://stackoverflow.com/questions/1495919/is-there-a-way-to-validate-individual-fields-in-jquery-not-the-whole-form
http://stackoverflow.com/questions/7429349/using-jquery-how-do-i-validate-individual-elements-and-show-the-relevant-error-m
jQuery学习之:Validation表单验证插件:
http://polaris.blog.51cto.com/1146394/258781
客户端验证的极品--jQuery.validator:
http://www.iteye.com/topic/255168
引用
jquery内置的maxlength验证的是输入的字符的长度。可以用这个来验证输入域的字节长度:
// 中文字两个字节
jQuery.validator.addMethod("byteRangeLength", function(value, element, param) {
var length = value.length;
for(var i = 0; i < value.length; i++){
if(value.charCodeAt(i) > 127){
length++;
}
}
return this.optional(element) || ( length >= param[0] && length <= param[1] );
}, "请确保输入的值在{0}-{1}个字节之间(一个中文字算2个字节)");
jquery.validate的用法(自定义方法验证,服务端验证):
http://hi.baidu.com/lxylxy888666/blog/item/ee96ab7b0c26f1f90ad18724.html
editable select list, plugin for jQuery:
http://coffeescripter.com/code/editable-select/
下列代码:
$(document).ready(function() {
$("input[name='fidsRuleParameter.type']").change(function() {
//alert($(this).val());
if($(this).val()=="I") {
$("#intValueUnitSpan").text("<s:text name='parameter.form.intValueUnit'/>");
} else {
$("#intValueUnitSpan").text("");
}
});
});
<td width="85%" align="left">
<input type="text" name="fidsRuleParameter.value" id="value" value="<s:property value="fidsRuleParameter.value"/>" class="intValueClass"/>
<span id="intValueUnitSpan"><s:if test='%{#request.fidsRuleParameter.type=="I"}'><s:text name='parameter.form.intValueUnit'/></s:if></span>
</td>
<tr bgcolor="#FFFFFF">
<td width="15%" align="right"><label for="stationCode"><s:text name='parameter.form.type'/>: </label></td>
<td width="85%" align="left">
<s:radio id="fidsRuleParameter.type" name="fidsRuleParameter.type" theme="simple"
list="#{'I':getText('parameter.grid.renderer.type.I'), 'S':getText('parameter.grid.renderer.type.S')}"/>
</td>
</tr>
在IE下,radio的onchange事件在radio change时并没有被触发!而是在焦点移至页面其他域后才触发!这是IE的问题。解决办法是在jquery的ready方法中加上下列代码:
/** fix that problem: If you click on a radio button, IE seems to wait with firing the change event until you leave the button **/
$(function () {
if ($.browser.msie) {
$('input:radio').click(function () {
this.blur();
this.focus();
});
}
});
相关链接:
http://norman.walsh.name/2009/03/24/jQueryIE
引用
If you click on a radio button, IE seems to wait with firing the change event until you leave the button, which is consistent with the behavior on other input fields (like text), but kinda unintuitive. The following piece of code fixes this behavior for me:
$(function () {
if ($.browser.msie) {
$('input:radio').click(function () {
this.blur();
this.focus();
});
}
});
在IE中关于Radio和Checkbox在JQuery中的change事件的立即触发:
http://blog.csdn.net/borishuai/archive/2009/12/08/4967696.aspx