<pre name="code" class="javascript"> var $x = $("div");
<strong><span style="font-size:24px;"> $x.prop("color","FF0000"); 添加属性</span></strong>
$x.append("<br>color 属性值为: " + $x.prop("color")); 获取属性;
<strong><span style="font-size:24px;"> $x.removeProp("color"); 删除属性</span></strong>
$x.append("<br>现在 color 属性值为: " + $x.prop("color"));
如果使用prop()
函数操作表单元素的checked
、selected
、disabled
等属性,如果该元素被选中(或禁用),则返回true
,否则(意即HTML中没有该属性)返回false
。
beforeSubmit: function() {
<span style="font-size: 13px;"> $('#login_form').find(':input').</span><span style="font-size:24px;"><strong>prop</strong></span><span style="font-size: 13px;">('</span><strong style="font-size: 13px;">disabled'</strong><span style="font-size: 13px;">, true);
},</span>