jQuery 擴(kuò)展對(duì)input的一些操作方法
更新時(shí)間:2009年10月30日 13:19:00 作者:
擴(kuò)展對(duì)input的一些方法(練習(xí)jQuery插件)
復(fù)制代碼 代碼如下:
/* ================================================================================
File:jquery.hy.input.js
Desc: 擴(kuò)展對(duì)input的一些方法
Called by:
Auth: 大氣象
Date: 2009-10-30
================================================================================
Change History
================================================================================
Date: Author: Description:
-------- -------- -------------------
================================================================================
Copyright (C) 1992-2009 Hongye Corporation
================================================================================
*/
//擴(kuò)展jQuery對(duì)象方法
jQuery.fn.extend({
/*===========================================================================
功能描述:?jiǎn)螕魰r(shí)清空文本框
調(diào)用方法:
$(function(){ jQuery("#txt").txtClear();} );
*/
txtClear:function(){
jQuery(this).click(function(){
jQuery(this).val('');
});
},
/*===========================================================================
功能描述:選擇全選
調(diào)用方法:
情形
<div id="chkBoxes">
<input id="Checkbox1" type="checkbox" />
<input id="Checkbox2" type="checkbox" />
</div>
調(diào)用
$("#chkBoxes input[type=checkbox]").check();
*/
check:function(){
return this.each(function(){this.checked=true;});
},
/*===========================================================================
功能描述:取消選擇
調(diào)用方法:
$("#chkBoxes input[type=checkbox]").uncheck();
*/
uncheck:function(){
return this.each(function(){this.checked=false;});
}
});
您可能感興趣的文章:
- jquery attr方法獲取input的checked屬性問(wèn)題
- jquery檢測(cè)input checked 控件是否被選中的方法
- jQuery操作input值的各種方法總結(jié)
- jquery 定位input元素的幾種方法小結(jié)
- jQuery文本框(input textare)事件綁定方法教程
- jquery(live)中File input的change方法只起一次作用的解決辦法
- Jquery和JS用外部變量獲取Ajax返回的參數(shù)值的方法實(shí)例(超簡(jiǎn)單)
- jQuery 獲取URL的GET參數(shù)值的小例子
- jQuery控制輸入框只能輸入數(shù)值的小例子
- 使用jQuery實(shí)現(xiàn)input數(shù)值增量和減量的方法
相關(guān)文章
jQuery創(chuàng)建及操作xml格式數(shù)據(jù)示例
這篇文章主要介紹了jQuery創(chuàng)建及操作xml格式數(shù)據(jù),結(jié)合實(shí)例形式分析了jQuery針對(duì)xml格式數(shù)據(jù)的創(chuàng)建、解析、添加等相關(guān)操作技巧,需要的朋友可以參考下2018-05-05jQuery 1.9.1源碼分析系列(十)事件系統(tǒng)之綁定事件
這篇文章主要介紹了jQuery 1.9.1源碼分析系列(十) 事件系統(tǒng)——綁定事件的相關(guān)資料,需要的朋友可以參考下2015-11-11jquery ajax,ashx,json的用法總結(jié)
本篇文章主要是對(duì)jquery ajax,ashx,json的用法進(jìn)行了詳細(xì)的總結(jié)介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助2014-02-02jQuery中insertBefore()方法用法實(shí)例
這篇文章主要介紹了jQuery中insertBefore()方法用法,實(shí)例分析了insertBefore()方法的功能、定義及把匹配的元素插入到另一個(gè)指定的元素集合前面的使用技巧,需要的朋友可以參考下2015-01-01jQuery在ul中顯示某個(gè)li索引號(hào)的方法
這篇文章主要介紹了jQuery在ul中顯示某個(gè)li索引號(hào)的方法,涉及jQuery遍歷元素的技巧,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2015-03-03