当前位置:Gxlcms > JavaScript > jQuery的attr与prop使用介绍_jquery

jQuery的attr与prop使用介绍_jquery

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

attribute与property

attribute和property都可以翻译为属性,为了以示区别,通常把这两个单词翻译为属性与特性。

Click Here

上面这段HTML语句中有三个节点,分别是Element “div”、attribute “id”、Text “click here”,我们最常见的attribute正式指的attribute类型节点,在JavaScript有专门处理attribute的函数 .getAttribute(name) / setAttribute(name,value)。当然attribute不只是我们能够在HTML文档上看到的这几个,我们可以自定义attributed加到DOM节点中

代码如下:

123