🤑 Join the Treehouse affiliate program and earn 25% recurring commission!

New No-Code Track! 🚀 New videos dropping every week—start learning today!

🌟 Dreaming of a bright future? 🎓 Ask about the Treehouse Scholarship program! 🚀

✨ Earn college credits in Cybersecurity, JS, HTML, CSS and Python

  • Treehouse Logo
  • Plans
    Chevron
    • For Individuals
    • For Businesses
    • For Schools
    • For Libraries
    • For Military
  • Library
    Chevron
    • All Courses
    • Tracks
    • College Credit
  • Techdegree
    Chevron
    • Overview
    • Front End Development
    • Full Stack JavaScript
    • Data Analysis
    • UX Design
    • Python
  • Community
    Chevron
    • Community Projects
    • Live Sessions
    • Code Adventures
    • Discord
    • Forum
    • Success Stories
    • Treehouse Links
    • 100 Days of Code
  • Resources
    Chevron
    • Career Toolbox
    • CodeForward
    • Free Treehouse Near Me
    • Jobs
    • Blog
    • Support
    • About
  • For Individuals For Businesses For Schools For Libraries For Military
  • All Courses Tracks College Credit
  • Overview Front End Web Development Full Stack JavaScript Python Development Data Analysis UX Design
  • Community Projects Live Sessions Code Adventures Discord Forum Success Stories Treehouse Links 100 Days of Code
  • Career Toolbox CodeForward Free Treehouse Near Me Jobs Blog Support About
  • Sign In
  • Free Trial
Instagram Twitter Facebook YouTube LinkedIn
    • Newest
      • Newest
      • Active
      • Unanswered
      • Featured
    • All Topics
      • All Topics
      • • General Discussion
      • • AI
      • • Android
      • • APIs
      • • Coding for Kids
      • • College Credit
      • • Computer Science
      • • CSS
      • • Data Analysis
      • • Databases
      • • Design
      • • Development Tools
      • • Digital Literacy
      • • Game Development
      • • Go Language
      • • HTML
      • • Java
      • • JavaScript
      • • Learning Resources
      • • Machine Learning
      • • No-Code
      • • PHP
      • • Professional Growth
      • • Python
      • • Quality Assurance
      • • React
      • • Ruby
      • • Security
      • • Swift
  • Roy Cma
    Roy Cma
    3,147 Points

    getting an element by its ID

    Posted August 26, 2024 5:17am by Roy Cma
    Roy Cma
    3,147 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    3 Answers

  • Vasil Ginin
    Vasil Ginin
    9,919 Points

    Can you guys please help me with this one I tried everything.

    Posted May 19, 2024 10:20pm by Vasil Ginin
    Vasil Ginin
    9,919 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    1 Answer

  • Nicholas Mason
    Nicholas Mason
    2,313 Points

    I'm super confused

    Posted November 9, 2023 12:40am by Nicholas Mason
    Nicholas Mason
    2,313 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    2 Answers

  • Ericka Erickson
    Ericka Erickson
    9,982 Points

    const button = document.getElementById("btn-pharse"); is this not right?

    Posted October 17, 2023 5:38pm by Ericka Erickson
    Ericka Erickson
    9,982 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    1 Answer

  • Michael Lugo
    Michael Lugo
    4,921 Points

    Javascript and the DOM getElementById method challenge question...

    Posted January 16, 2023 9:11pm by Michael Lugo
    Michael Lugo
    4,921 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    1 Answer

  • Chiaki Yamada
    seal-mask
    .a{fill-rule:evenodd;}techdegree seal-36
    Chiaki Yamada
    Front End Web Development Techdegree Graduate 14,523 Points

    I don't know what's wrong with this code

    Posted November 25, 2022 4:11am by Chiaki Yamada
    .a{fill-rule:evenodd;}techdegree seal-36
    Chiaki Yamada
    Front End Web Development Techdegree Graduate 14,523 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    1 Answer

  • aliyahchen
    aliyahchen
    5,829 Points

    I already use document.getElementById to select the input-phrase. however, the feedback is I didn't use it

    Posted August 16, 2022 2:39pm by aliyahchen
    aliyahchen
    5,829 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    1 Answer

  • Ander Bil
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    Ander Bil
    Full Stack JavaScript Techdegree Student 6,480 Points

    return the element containing the id?

    Posted August 4, 2022 1:19pm by Ander Bil
    .a{fill-rule:evenodd;}techdegree
    Ander Bil
    Full Stack JavaScript Techdegree Student 6,480 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    1 Answer

  • Barbara Vega
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    Barbara Vega
    Full Stack JavaScript Techdegree Student 19,486 Points

    Can someone please let me know what I'm doing wrong for this step? I'm getting a type error. Thanks!

    Posted May 13, 2022 9:56pm by Barbara Vega
    .a{fill-rule:evenodd;}techdegree
    Barbara Vega
    Full Stack JavaScript Techdegree Student 19,486 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    1 Answer

  • Kakhaber Tchanturia
    Kakhaber Tchanturia
    7,754 Points

    Can't declare second variable.

    Posted February 3, 2022 2:29am by Kakhaber Tchanturia
    Kakhaber Tchanturia
    7,754 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    1 Answer

  • Ronnie Hodges
    Ronnie Hodges
    5,812 Points

    const input = document.getElementById(`input-phrase`);

    Posted December 13, 2021 4:51am by Ronnie Hodges
    Ronnie Hodges
    5,812 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    1 Answer

  • Seth Look
    Seth Look
    15,598 Points

    nothing works

    Posted December 1, 2021 11:31pm by Seth Look
    Seth Look
    15,598 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    1 Answer

  • Oleksandra Smith
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    Oleksandra Smith
    Front End Web Development Techdegree Student 9,361 Points

    Next, declare a new variable named input. Point the variable to the input element with the ID input-phrase. Use the meth

    Posted November 9, 2021 1:16am by Oleksandra Smith
    .a{fill-rule:evenodd;}techdegree
    Oleksandra Smith
    Front End Web Development Techdegree Student 9,361 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    1 Answer

  • Arya G
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    Arya G
    Full Stack JavaScript Techdegree Student 10,503 Points

    Declare a variable named button. Assign the variable the <button> element with the ID btn-phrase. Use the method that re

    Posted November 4, 2021 5:30am by Arya G
    .a{fill-rule:evenodd;}techdegree
    Arya G
    Full Stack JavaScript Techdegree Student 10,503 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    2 Answers

  • Alex Zhou
    Alex Zhou
    11,943 Points

    Anyone know why I keep on getting "Bummer: Cannot read property '1' of null"?

    Posted October 21, 2021 2:06pm by Alex Zhou
    Alex Zhou
    11,943 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    1 Answer

  • Shine Browning
    Shine Browning
    2,304 Points

    Help please. I'm stuck on Task 2 and can't get the answer right.

    Posted October 12, 2021 1:23pm by Shine Browning
    Shine Browning
    2,304 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    3 Answers

  • Kelsey Donegan
    Kelsey Donegan
    3,342 Points

    Is step 1 not exactly the same as step 2?

    Posted August 25, 2021 7:34pm by Kelsey Donegan
    Kelsey Donegan
    3,342 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    1 Answer

  • Ricky Redman
    Ricky Redman
    7,520 Points

    I'm confused about this challenge, is the id entered the into a method?

    Posted August 12, 2021 11:26pm by Ricky Redman
    Ricky Redman
    7,520 Points
    • JavaScript
    • JavaScript and the DOM
    • Getting a Handle on the DOM
    • Select by ID

    1 Answer

Posting to the forum is only allowed for members with active accounts.
Please sign in or sign up to post.

    Treehouse

  • About
  • Blog
  • Careers
  • Community
  • Stories
  • Shop
  • Contact
  • Gift Card

See Full Catalogue

Techdegree

  • Front End Web Development
  • Full Stack JavaScript
  • Python Development
  • Data Analysis
  • UX Design

Tracks

  • Learn to Code for Beginners
  • Beginning Python
  • Beginning SQL
  • Beginning Java
  • ...see more

Courses

  • JavaScript Basics
  • Intro to HTML & CSS
  • Python Basics
  • CSS Layout
  • ...see more

Explore

  • Plans
  • Affiliates
  • Perks
  • Free Treehouse Near Me
  • Treehouse for Libraries
  • Treehouse for Businesses
  • Twitter
  • YouTube
  • Facebook
  • LinkedIn
  • Instagram
Terms & Conditions | Privacy

© 2025 Treehouse Island, Inc.