Skip to content

Useful Tip for getting HTML component tags by class name

October 24, 2014

Here is a quick tip for getting HTML component tags by class name.

To do this, you need to call the getElementsByClassName with the class name, and as the result is stored as an object array, you call the nth element, e.g the first element is called y[0], and to get the HTML content, you use innerHTML. If there is more than one element with the same name, you call y[1] etc.

See below.

var y = document.getElementsByClassName(“SmallTabSelected”);
var getValue = y[0].innerHTML;


From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: