美文网首页English
what we should know about the el

what we should know about the el

作者: 许泽武 | 来源:发表于2020-04-20 18:03 被阅读0次

    Usually, we  use document.getElementById to get the element node. As the general JavaScript object, it naturally has its properties like innerHTML and methods like setAttribute. But, it has so many properties, what should we do to classify them? Well, we can consider if the property belongs to itself or not. For example, the style and the innerHTML properties is belong to, but the childNodes, the parentNode,the  previousElementSibling and nextElementSibling are not. 

    Some common properties like class and id, we can simply get and set it by element.class and element.id, for another properties like name and title, we can customize and visit  it by setAttribute and getAttribute.

    相关文章

      网友评论

        本文标题:what we should know about the el

        本文链接:https://www.haomeiwen.com/subject/ifwdihtx.html