Get value of a custom attribute


How can I get the value of a custom attribute using JavaScript?


<strong id="the_id" original-title="I NEED THIS">

I’ve tried .getAttribute() and jQuery’s .attr() without success.


Adding custom attributes makes your HTML invalid. Use custom data attributes instead:

<strong id="the_id" data-original-title="I NEED THIS">

Answered By – jinsky

Answer Checked By – Clifford M. (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.