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 :).


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

========== Social Links ==========

Twitter – @TheNetNinja –


  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?


Please enter your comment!
Please enter your name here