Jquery備忘錄
1. radio賦值
[code="javascript"]
$('[name=strategyPeriod][value=${empty collectStrategy ? 1 : collectStrategy.strategyPeriod}]').attr("checked",'checked');
$('[name=strategyMode][value=${empty collectStrategy ? 1 : collectStrategy.strategyMode}]').click();
[/code]
2. 彈出層--使用thickbox
打開js源碼查看調用函數:
彈出層:tb_show("ssss", "#TB_inline?height=300&width=300&inlineId=testID")
關閉層:parent.tb_remove();
3. 判斷包裝集是否滿足一種條件使用is('')函數
4. 判斷電話號碼
$.validator.addMethod("telephone", function(val, element) {
var length = val.length;
var mobile = /^((0?1[358]\d{9})|([1-9]\d{6,7}))$/;
return this.optional(element) || mobile.test(val);
}, "電話號碼格式錯誤");
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.