Issue
How can I get the value of a custom attribute using JavaScript?
Like
<strong id="the_id" original-title="I NEED THIS">
I’ve tried .getAttribute()
and jQuery’s .attr()
without success.
Solution
Adding custom attributes makes your HTML invalid. Use custom data attributes instead:
<strong id="the_id" data-original-title="I NEED THIS">
$('#the_id').data('original-title')
https://jsbin.com/akoyut/2/edit
Answered By – jinsky
Answer Checked By – Clifford M. (AngularFixing Volunteer)