JavaScript/attribute:修订间差异
来自康健生活
创建页面,内容为“== 引言 == == class == === classList === {| class="wikitable" |- | contains || <code>ele.classList.contains('checked')</code> || 含有 |- | remove || <code>ele.cl…” |
|||
| 第11行: | 第11行: | ||
|} | |} | ||
{{Warning|IE 10 以下不兼容{{Qm}}}} | {{Warning|IE 10 以下不兼容{{Qm}}}} | ||
=== getAttribute === | |||
<syntaxhighlight lang="javascript"> | |||
ele.getAttribute('class').indexOf('checked') > -1 | |||
// | |||
node.className.indexOf('checked') > -1</syntaxhighlight> | |||