当前位置:Gxlcms > JavaScript > jquery$(this).attr$(this).val方法使用介绍_jquery

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

时间:2021-07-01 10:21:17 帮助过:12人阅读

$(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 值

人气教程排行