Yo ninjas, so in this javascript lesson I want to build on the last tutorial by introducing the getAttribute and setAttribute methods for changing the attributes on your HTML elements.
getAttribute allows us to read the value of any given attribute, and setAttribute allows us to set the attribute value to whatever we want.
If you have any questions, fire away 🙂
DOM OBJECT METHODS AND PROPERTIES – http://www.w3schools.com/jsref/dom_obj_all.asp
SUBSCRIBE TO CHANNEL – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg?sub_confirmation=1
========== JavaScript for Beginners Playlist ==========
========== CSS for Beginners Playlist ==========
========== HTML for Beginners Playlist ==========
========== The Net Ninja ============
For more front-end development tutorials & to black-belt your coding skills, head over to – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg or http://thenetninja.co.uk
========== Social Links ==========
Twitter – @TheNetNinja – https://twitter.com/thenetninjauk
Original source
15 responses to “JavaScript Tutorial For Beginners #35 – Changing Element Attributes”
Is there any way to change class attribute of an html tag permanently in whole of website.
Is there anyway you could perhaps provide the html for your old website so we can follow along?
these tutorials are addictive! VERY helpful , and very grateful for people like you
"what the hell, this is just an example". LOL!
I would love to personally meet this guy.
Your vids are cool Sir, it makes me comprehend JS more. Thank you!
Good for the mistake, we learned how to distinguish between methods and properties
Super good tutorials! Thanks 🙂
getAttribute does not seem to be showing as a function for me please could someone help
You deserve about 100k more subs. Thanks for all the indirect help.
Hi, Shaun first of all I want to thank you for your hard work. Second thanks for clearing my mind when you called .innerHTML and .textContent METHODS, i got a little confuse trying to set my mind. I love how HAPPY you start each tutorial video. GO GO NINJA. Thanks a lot.
Finding these really fun Shaun
Have you thought about doing these tutorials in Brackets so it will be a
more real and easy to follow along demonstration?? – or do you get into
that later?
Best JS tuts….thanks!
Hi! Love ur vids!!
Is it just me or do properties and methods seem to work a little bit on the opposite side with the DOM? coz when you use innerHTML to change the tags and content, it's like u r using a method/or function, but using getAttribute, is like trying to show the property "attribute" ( even tho that's not the case) if that makes any sense.
Any chance I could talk you into annotating that intro with the changes onto the last video where you make the mistakes?