SHARE

Hey ninjas, in this JavaScript tutorial, we’ll be looking again at the setAttribute method to control in-line styling of our HTML elements, as well as utilizing the ‘style’ property that all DOM objects have access to.

If you have any questions at all, fire away :).

SUBSCRIBE TO CHANNEL – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg?sub_confirmation=1

========== JavaScript for Beginners Playlist ==========

https://www.youtube.com/playlist?list=PL4cUxeGkcC9i9Ae2D9Ee1RvylH38dKuET

========== CSS for Beginners Playlist ==========

https://www.youtube.com/playlist?list=PL4cUxeGkcC9gQeDH6xYhmO-db2mhoTSrT

========== HTML for Beginners Playlist ==========

https://www.youtube.com/playlist?list=PL4cUxeGkcC9ibZ2TSBaGGNrgh4ZgYE6Cc

========== 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

12 COMMENTS

  1. For adding classes instead of replacing them, we can use

    title.className += " " + "your_class_name_here"

    The space preceding is important because js concatinates it with the previous class

  2. Thanks for the clear short tutorials. What would be a practical use for this? Apart from changing elements in the console window?

  3. I had been beating my head up against a rock trying to comprehend the basics of JS and your channel helps tremendously. Thank you! And lovely accent.

  4. When viewing the "text" list for style, the property is referenced as "background-color," but when setting the attribute it's camel cased without a hyphen (which is logical as attribute names cannot have hyphens as these would be minus signs). Is inconsistency here to keep the riff-raff out?

LEAVE A REPLY

Please enter your comment!
Please enter your name here