Working with restricted attributes


show more Working with restricted attributes provides you with in-depth training on Developer. Taught by Ray Villalobos as part of the JavaScript: Enhancing the DOM show less
please wait ...

Working with restricted attributes

The quickest way to work with element attributes is to use the dot notation. That's not always convenient because sometimes attribute names like class or for can be restricted in JavaScript. But there's another way of doing it. JavaScript provides a few functions for dealing with attributes. So, for example, you can use the getAttribute method to get the value of any attribute in an element. If you set attribute you can set the value of an existing attribute. You can check to see if an element has an attribute function. Finally, you can remove an attribute with the delete attribute function. So let's take a look at these in a document.

Here's our web page. I'm going to go over to the registration page, and I'm going to pull up the console, Cmd+Option+I, Ctrl+Alt+I on a PC, and then hit escape. And then I'm going to create a variable called My Node, and pass it, and element in my DOM. (SOUND) So, I'm going to test that out. And you can see th...

Working with restricted attributes
Video duration: 2m 49s 2h 3m Intermediate

Viewers:

Working with restricted attributes provides you with in-depth training on Developer. Taught by Ray Villalobos as part of the JavaScript: Enhancing the DOM

Subjects:
Developer Web
Software:
HTML JavaScript
Author:
please wait ...