Site menu

CodeCook.io

  • Languages
    • C
    • C++
    • CSS
    • Git
    • HTML
    • Java
    • JavaScript
    • jQuery
    • PHP
    • Python
    • Ruby
    • Scala
  • dom
  • element
  • id

JavaScript - Select dom element by id

Returns a reference to a DOM element by its ID.

0
586
  • Share on Facebook
  • Share on Google+
  • Share on Twitter
document.getElementById('{{id}}')
javascript

Notes

  • Returns "null" if not found

last update: Oct. 26, 2014

Advertisement

This project is hosted on DigitalOcean, try it and support us

Related concept

  • Select dom element by class
  • Select element by data attribute
  • Toggle DOM element class
  • Get DOM element data attribute
  • Select dom elements by tag
  • Select dom element by css query

Other language

  • jQuery

Random task

  • If condition do
  • Prepend item to array
  • Django redirect directly in urls.py
  • Remove crontab for user
  • Do loop while a condition is true
  • Blog
  • About
  • License