Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jquery get data-id

To get the contents of the attribute data-id (like in <a data-id="123">link</a>) ///you have to use

$(this).attr("data-id") // will return the string "123"

//or .data() (if you use newer jQuery >= 1.4.3)

$(this).data("id") // will return the number 123
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #jquery
ADD COMMENT
Topic
Name
1+9 =