jquery $(this).attr $(this).val方法使用介紹
更新時(shí)間:2013年10月08日 14:32:31 作者:
$(this).attr(key); 獲取節(jié)點(diǎn)屬性名的值,相當(dāng)于getAttribute(key)方法,本文整理了一些相關(guān)的示例,感興趣的朋友可以參考下
$(this).attr(key); 獲取節(jié)點(diǎn)屬性名的值,相當(dāng)于getAttribute(key)方法
$(this).attr(key, value); 設(shè)置節(jié)點(diǎn)屬性的值,相當(dāng)于setAttribute(key,value)方法
eg:<div id="w_1" class="widget" diywidgetid="${template.diyWidgetId}"></div>
var diywidgetid = $('#w_1').attr('diywidgetid'); //獲取節(jié)點(diǎn)屬性的值
$(this).val();獲取某個(gè)元素節(jié)點(diǎn)的value值,相當(dāng)于$(this).attr(“value”);
$(this).val(value);設(shè)置某個(gè)元素節(jié)點(diǎn)的value值,相當(dāng)于$(this).attr(“value”,value);
eg:<input id="i_eg" value="1" type="text"></input>
var i_eg=$('#i_eg').val(); // 獲取元素節(jié)點(diǎn)的value 值
$(this).attr(key, value); 設(shè)置節(jié)點(diǎn)屬性的值,相當(dāng)于setAttribute(key,value)方法
eg:<div id="w_1" class="widget" diywidgetid="${template.diyWidgetId}"></div>
var diywidgetid = $('#w_1').attr('diywidgetid'); //獲取節(jié)點(diǎn)屬性的值
$(this).val();獲取某個(gè)元素節(jié)點(diǎn)的value值,相當(dāng)于$(this).attr(“value”);
$(this).val(value);設(shè)置某個(gè)元素節(jié)點(diǎn)的value值,相當(dāng)于$(this).attr(“value”,value);
eg:<input id="i_eg" value="1" type="text"></input>
var i_eg=$('#i_eg').val(); // 獲取元素節(jié)點(diǎn)的value 值
您可能感興趣的文章:
- jQuery AJAX回調(diào)函數(shù)this指向問題
- jQuery 選擇方法及$(this)用法實(shí)例分析
- 淺談jQuery this和$(this)的區(qū)別及獲取$(this)子元素對(duì)象的方法
- jQuery中$this和$(this)的區(qū)別介紹(一看就懂)
- 實(shí)例講解JQuery中this和$(this)區(qū)別
- 詳談jQuery中的this和$(this)
- 通過$(this)使用jQuery包裝后的方法或?qū)傩?/a>
- jquery中this的使用說明
- JQuery this 和 $(this) 的區(qū)別
- JQuery中this的指向詳解
相關(guān)文章
jquery實(shí)現(xiàn)html頁(yè)面 div 假分頁(yè)有原理有代碼
大概原理就是填充后div的總高度 (1000px) 顯示高度(100px) 則頁(yè)面總數(shù)為10頁(yè) 。當(dāng)查看第二頁(yè)時(shí),顯示的div高度為100 - 200之間,以此類推2014-09-09
jQuery遮罩層實(shí)現(xiàn)方法實(shí)例詳解(附遮罩層插件)
這篇文章主要介紹了jQuery遮罩層實(shí)現(xiàn)方法,結(jié)合實(shí)例形式較為詳細(xì)的分析了jQuery遮罩層樣式及功能實(shí)現(xiàn)技巧,并附帶分析了一個(gè)簡(jiǎn)單jQuery遮罩層插件實(shí)現(xiàn)方法,需要的朋友可以參考下2015-12-12
jQuery彈層插件jquery.fancybox.js用法實(shí)例
這篇文章主要介紹了jQuery彈層插件jquery.fancybox.js用法,結(jié)合實(shí)例形式分析了jQuery彈出層插件jquery.fancybox.js的功能、用法與相關(guān)注意事項(xiàng),需要的朋友可以參考下2016-01-01
解決攔截器對(duì)ajax請(qǐng)求的攔截實(shí)例詳解
這篇文章主要介紹了解決攔截器對(duì)ajax請(qǐng)求的攔截實(shí)例詳解的相關(guān)資料,需要的朋友可以參考下2016-12-12

