Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jquery get data attribute value

/* html */
<a data-id="123">link</a>

/* js */
$(this).attr("data-id") // returns string "123"

$(this).data("id") // returns number 123 (jQuery >= 1.4.3 only)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #jquery #data #attribute
ADD COMMENT
Topic
Name
7+3 =