Get value of a Custom Attribute using Javascript or Jquery Get value of a Custom Attribute using Javascript or Jquery jquery jquery

Get value of a Custom Attribute using Javascript or Jquery


Don't use space in id.

And adding custom attributes make your html invalid. Use data-attributes instead:

<strong id="the_id" data-original-title="I NEED THIS">$('#the_id').data('original-title');

http://jsbin.com/akoyut/2/edit


Change "the id" to "the_id".

You can do it using plain javascript:

document.getElementById("the_id").getAttribute("original-title");


Best Way to use like this:

jQuery(this).attr('original-title');