JavaScript Tutorial For Beginners #35 – Changing Element Attributes




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”

  1. 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.

  2. 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.

Leave a Reply