stiffle stiffle - 1 year ago 96
Javascript Question

Get value of a Custom Attribute using Javascript or Jquery

How can I get the value of a custom attribute using javascript or jquery?


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

I've tried with
.getAttribute() and attr()
..(Javascrupt & jQuery) without success any idea?

Answer Source

Don't use space in id.

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

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


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download