3.2 - JS + HTML
Connecting two technologies to create interactive pages!
Today's Lesson: 3.2 - JS + HTML
The big takeaways from today's lesson are:
document.getElementById("id") // Will return a handle of the first element found with the matching ID. This is why unique identifiers are so crucial.
document.getElementsByName("name") // Will return all elements with the matching name (more on that another time because it uses something called an Array).
To modify an HTML element, grab its handle and then modify it:
In-class demo recorded using Scrimba so you can play with the code yourself. (Note that some items (like buttons) do not render while the video is playing. But if you pause the video and click RUN yourself, the preview page renders properly.)
This one is purposefully quick. Fork this Repl and follow the instructions.
Hint - to add to the contents of a variable so that it isn't destroyed, you can do something like this:
myVar = myVar + "stuff to add";
Today's RST Journal Entry:
You've had your first taste of programming. What have you learned? What was a struggle? What are you interested in?
What did you notice, what do you wonder?
Time to make your second journal entry for your RST portfolio. Any questions, just ask.