jquery $(this).attr $(this).val方法使用介绍

2022-01-13,,,,

$(this).attr(key); 获取节点属性名的值,相当于getAttribute(key)方法,本文整理了一些相关的示例,感兴趣的朋友可以参考下

$(this).attr(key); 获取节点属性名的值,相当于getAttribute(key)方法

$(this).attr(key, value); 设置节点属性的值,相当于setAttribute(key,value)方法

eg:

var diywidgetid = $('#w_1').attr('diywidgetid'); //获取节点属性的值

$(this).val();获取某个元素节点的value值,相当于$(this).attr(“value”);

$(this).val(value);设置某个元素节点的value值,相当于$(this).attr(“value”,value);

eg:

var i_eg=$('#i_eg').val(); // 获取元素节点的value 值

以上就是jquery $(this).attr $(this).val方法使用介绍的详细内容,更多请关注本站其它相关文章!

《jquery $(this).attr $(this).val方法使用介绍.doc》

下载本文的Word格式文档,以方便收藏与打印。