Created
April 1, 2022 00:11
-
-
Save bnicholas/665522b4e6a5f466f55312f29402d248 to your computer and use it in GitHub Desktop.
Me and AJs chat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AJ - let pet = document.getElementById('#pet'); | |
document.queryselectorAll("#pet"); | |
// Obtain the 'shrink-grow' button, and assign it to the changeSize variable | |
let changeSize = document.getElementById('#shrink-grow') | |
AJ - am i on the right path | |
ME - querySelectorAll will give you a collection of results | |
querySelector will give you just the first or only one | |
Google getElementById and look at the syntax | |
I’d say you’re close on the getElementById syntax. Or you may be mixing it up with querySelector | |
AJ - do i need the queryselector | |
ME - That’s about all tips I can give | |
You need what you need. You don’t need two of what you only need one for. | |
This is about reasoning about what you need to accomplish, and picking a tool to accomplish it. | |
For each step of the bigger picture. | |
"I need to target this specific HTML element and assign it to a variable" | |
"What do I have to work with in the HTML? Tag names, class, id …" | |
"What tools do I have?" | |
"getElementById, querySelector, querySelectorAll … Do I know what each of those do?" | |
If not … I google each one and read. Then decide which tool will do the job. And follow the documentation you found with google | |
AJ - ok | |
ME - That’s how to think about it | |
Just one thing at a time | |
AJ - ok | |
ME - Make sure your HTML is all filled in | |
Make sure your CSS does what it’s supposed to | |
Then finish with Javascript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment