JavaScript Element title Property Tutorial

In this section, we will learn what the Element title property is and how to use it in JavaScript.

What is Element title Property in JavaScript?

The JavaScript Element title property is used to set or get the value of the title attribute for an element.

You can learn more about the HTML title attribute in its section, but in short, this attribute is mainly used to give extra information about an element which appears as a tool-tip if you hover a mouse cursor on top of the target element.

Element title Property Syntax:

element.title;

element.title = “newValue”;

Element title Property Input Value

The value we set for this property will be used as the new value for the title attribute of an element.

Element title Property Return Value

The return value of this property is the current value set for the title attribute of the target element.

Example: using title Property in JavaScript

See the Pen Untitled by Omid Dehghan (@odchan1) on CodePen.

Facebook
Twitter
Pinterest
LinkedIn

Top Technologies