Git Product home page Git Product logo

javascript-dom's Introduction

General Assembly Logo

JS DOM Practice

Instructions

  1. Fork and clone this repository.
  2. Change into the new directory.

JS DOM Practice

Practice getting elements from the DOM using the common methods for interacting with the DOM!

For each of these you should store the result in a variable and console.log it see if you got it right.

1. getElement(s)By

The first set of DOM getters we'll talk about are the getElement(s)By methods, like getElementById. Open up getelements.js and work through the prompts.

2. querySelector

The second set of DOM getters we'll talk about are querySelector and querySelectorAll. Comment out getelements.js in index.html and uncomment queryselector.js. Then open up queryselector.js and work through the prompts.

3. Updating DOM Content

Use the following methods of DOM nodes to update the content of the DOM:

  • innerHTML
  • outerHTML
  • innerText
  • outerText
  • textContent

4. Working with the classList API

The following are the three methods we can use to work with classes on a DOM node:

  1. .classList.add()
  2. .classList.remove()
  3. .classList.toggle()

5. Working with data-* Attributes

Use the data-* attribute to add data to a DOM node. You can get that data in JavaScript with a node's dataset property.

  1. All content is licensed under a CC­BY­NC­SA 4.0 license.
  2. All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].

javascript-dom's People

Contributors

thecoachanna 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.