跳到主要内容

prop

prop(name) ⇒ value
prop(name, value) ⇒ self
prop(name, function(index, oldValue){ ... }) ⇒ self
prop({ name: value, name2: value2, ... }) ⇒ self

Read or set properties of DOM elements. This should be preferred over attr in case of reading values of properties that change with user interaction over time, such as checked and selected.

Short and lowercase names such as for, class, readonly and similar will be mapped to actual properties such as htmlFor, className, readOnly, etc.