How to Modify Elements with getElementsByTagName


show more Modifying elements with getElementsByTagName provides you with in-depth training on Developer. Taught by Ray Villalobos as part of the JavaScript and AJAX show less
please wait ...

Modifying elements with getElementsByTagName

When working with AJAX sometimes you want to access an individual element and sometimes you want to access groups of elements. We looked at how to do individual elements with getElementById in the last video, and in this movie we are going to take a look at accessing groups of elements with getElementByTagName. So you could, for example, ask for the third list element in an unordered list. We are going to need to update our HTML code to do something like that. So, I'll get rid of this div right here and then I'll add an unordered list with some elements. Now I am going to save this and switch over to my script code and modify this getElementById and make that getelements. Remember, there is an S in there.

ByTagName, the tag that we want to access is the list item tag. So by doing this, we are going to place an array of elements into the modify variable. Now that we've got the array, we can access an individual element of that array by just putting in the index of the element ...

Modifying elements with getElementsByTagName
Video duration: 4m 56s 1h 12m Intermediate

Viewers:

Modifying elements with getElementsByTagName provides you with in-depth training on Developer. Taught by Ray Villalobos as part of the JavaScript and AJAX

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