银讯财经网
您的当前位置:首页jquery$(this).attr$(this).val方法使用介绍_jquery

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

来源:银讯财经网


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

显示全文