Giter VIP home page Giter VIP logo

demo-domjk's Introduction

demo-dom

dom.create(`<div>hi</div>`) 用于创建节点
dom.after(node, node2) 用于新增弟弟
dom.before(node, node2) 用于新增哥哥
dom.append(parent, child) 用于新增儿子
dom.wrap(`<div></div>`) 用于新增爸爸

dom.remove(node) 用于删除节点
dom.empty(parent) 用于删除后代

dom.attr(node, 'title', ?) 用于读写属性
dom.text(node, ?) 用于读写文本内容
dom.html(node, ?) 用于读写 HTML 内容
dom.style(node, {color: 'red'}) 用于修改 style
dom.class.add(node, 'blue') 用于添加 class
dom.class.remove(node, 'blue') 用于删除 class
dom.on(node, 'click', fn) 用于添加事件监听
dom.off(node, 'click', fn) 用于删除事件监听

dom.find('选择器') 用于获取标签或标签们
dom.parent(node) 用于获取父元素
dom.children(node) 用于获取子元素
dom.siblings(node) 用于获取兄弟姐妹元素
dom.next(node) 用于获取弟弟
dom.previous(node) 用于获取哥哥
dom.each(nodes, fn) 用于遍历所有节点
dom.index(node) 用于获取排行老几

demo-domjk's People

Contributors

zxjdzxb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.