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

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

New No-Code Track! 🚀start learning today!

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

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

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

  • 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
    • 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
  • 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
    • Showing results for:
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements
    • Close
  • s speir
    s speir
    3,991 Points

    Why can't we just use getElementsByClassName, instead of getElementsByTagName?

    Posted on Dec 27, 2016 by s speir
    s speir
    3,991 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    2 Answers

  • Camila N
    Camila N
    10,677 Points

    Why can't we just use querySelector(selector)?

    Posted on Jul 23, 2016 by Camila N
    Camila N
    10,677 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    3 Answers

  • john larson
    john larson
    16,594 Points

    how does this: checkBox.type = "checkbox" modify this: var checkBox = document.createElement("input")

    Posted on Jul 15, 2016 by john larson
    john larson
    16,594 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    1 Answer

  • Jonas Laberg
    Jonas Laberg
    2,365 Points

    Interactive web pages with javascript: chapter 'Perform Selecting Elements': Getting error 'taskInput is not defined'

    Posted on Jun 27, 2016 by Jonas Laberg
    Jonas Laberg
    2,365 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    1 Answer

  • Zach Robinson
    Zach Robinson
    8,862 Points

    Why are we using the getElementsByTagName method for the button functionality? Why not use an ID?

    Posted on May 14, 2016 by Zach Robinson
    Zach Robinson
    8,862 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    2 Answers

  • Bruno Dias
    Bruno Dias
    10,554 Points

    Can I add an id for Add task button?

    Posted on Apr 22, 2016 by Bruno Dias
    Bruno Dias
    10,554 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    1 Answer

  • Abirbhav Goswami
    Abirbhav Goswami
    15,450 Points

    Andrew put the wrong id in for the button.

    Posted on Feb 23, 2016 by Abirbhav Goswami
    Abirbhav Goswami
    15,450 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    1 Answer

  • Yijiao Wang
    Yijiao Wang
    1,793 Points

    To what extent can we combine JQuery and Javascript in one document?

    Posted on Jan 13, 2016 by Yijiao Wang
    Yijiao Wang
    1,793 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    1 Answer

  • david marjanac
    david marjanac
    4,851 Points

    why you put in var=button array [0]

    Posted on Dec 27, 2015 by david marjanac
    david marjanac
    4,851 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    1 Answer

  • Melody Wong
    Melody Wong
    1,476 Points

    workspace is not prompting like the video

    Posted on Dec 11, 2015 by Melody Wong
    Melody Wong
    1,476 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    0 Answers

  • Maxwell DeMers
    Maxwell DeMers
    6,853 Points

    Uncaught Reference Error in Console

    Posted on Sep 28, 2015 by Maxwell DeMers
    Maxwell DeMers
    6,853 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    2 Answers

  • David Elston
    David Elston
    8,112 Points

    "function" vs. "Function"

    Posted on Jul 28, 2015 by David Elston
    David Elston
    8,112 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    1 Answer

  • ammarkhan
    seal-mask
    .a{fill-rule:evenodd;}techdegree
    ammarkhan
    Front End Web Development Techdegree Student 21,661 Points

    Selecting elements in console?

    Posted on Jun 16, 2015 by ammarkhan
    .a{fill-rule:evenodd;}techdegree
    ammarkhan
    Front End Web Development Techdegree Student 21,661 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    2 Answers

  • Tony Brackins
    Tony Brackins
    28,766 Points

    getElementByID()...but no ID's.

    Posted on Jun 8, 2015 by Tony Brackins
    Tony Brackins
    28,766 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    2 Answers

  • kabir k
    PLUS
    kabir k
    Courses Plus Student 18,036 Points

    pure JavaScript vs. jQuery

    Posted on Jun 2, 2015 by kabir k
    kabir k
    Courses Plus Student 18,036 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    2 Answers

  • Francesco Belvedere
    Francesco Belvedere
    15,206 Points

    Shouldnt there be semicolons at the end of each var statement when declaring a function this way?

    Posted on Apr 14, 2015 by Francesco Belvedere
    Francesco Belvedere
    15,206 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    8 Answers

  • Chuong Nguyen
    Chuong Nguyen
    8,256 Points

    Why use document.getElementByTagName("span")[1] instead of document.getElementsByClassName("last_name")?

    Posted on Mar 9, 2015 by Chuong Nguyen
    Chuong Nguyen
    8,256 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    2 Answers

  • Jarrett Young
    Jarrett Young
    12,635 Points

    I'm having trouble completing the code challenge in the section following this video. Can't pass the second step.

    Posted on Feb 14, 2015 by Jarrett Young
    Jarrett Young
    12,635 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    3 Answers

  • Reid Larson
    Reid Larson
    12,711 Points

    why is everything coming up as undefined?

    Posted on Feb 4, 2015 by Reid Larson
    Reid Larson
    12,711 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    2 Answers

  • Joe Williams
    Joe Williams
    4,014 Points

    Unsure of what the HTML label is doing if I'm already using an Input ID

    Posted on Jan 22, 2015 by Joe Williams
    Joe Williams
    4,014 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    2 Answers

  • Muhammad Rizwan
    Muhammad Rizwan
    8,595 Points

    We did not create any array how can we use following code? var addButton= getElementsByTagName('button')[0];

    Posted on Nov 30, 2014 by Muhammad Rizwan
    Muhammad Rizwan
    8,595 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    4 Answers

  • Radha Bhambwani
    Radha Bhambwani
    10,182 Points

    Using firefox console instead of chrome's

    Posted on Nov 27, 2014 by Radha Bhambwani
    Radha Bhambwani
    10,182 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    2 Answers

  • jadaml
    jadaml
    11,593 Points

    Calls to variable in console coming up as not defined

    Posted on Nov 22, 2014 by jadaml
    jadaml
    11,593 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    4 Answers

  • Anna Steirer
    Anna Steirer
    6,734 Points

    Having same problem as below where the workspace is returning undefined variables. I have not tried other workspaces.

    Posted on Nov 11, 2014 by Anna Steirer
    Anna Steirer
    6,734 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    3 Answers

  • Ron L
    Ron L
    6,463 Points

    Code doesn't work in Workspace, but does in Sublime

    Posted on Oct 29, 2014 by Ron L
    Ron L
    6,463 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    3 Answers

  • Leah Thompson
    Leah Thompson
    14,997 Points

    variables not defined

    Posted on Oct 9, 2014 by Leah Thompson
    Leah Thompson
    14,997 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    2 Answers

  • Eric Vandenberg
    Eric Vandenberg
    9,095 Points

    Can't define a variable in Sublime

    Posted on Sep 3, 2014 by Eric Vandenberg
    Eric Vandenberg
    9,095 Points
    • JavaScript
    • Interactive Web Pages with JavaScript
    • Selecting Elements and Adding Events with JavaScript
    • Perform: Selecting Elements

    8 Answers

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.