select by id queryselector('#foo') code example Example: queryselector var el = document.querySelector(".myclass");