How to read data custom attribute from DOM in jquery -
i try read user id "data-user-id" using jquery "data" api not able value of custom data attribute
var userid = $(".invited-user").data("user-id");
i try above jquery code not user id
<div id="selected-items" style="display: block;"><div id="selected-items"><div class="selected-item"><span class="label label-info invited-user" data-user-id="51935d96db0cad4b290004c5"> <span class="invited-user-name"> kumaran </span> <button class="btn btn-info remove-btn">x</button> </span></div></div></div>
please suggestion jquery api read custom data attribute.
- check html doctype. should
<!doctype html>
- check javascript console possible errors
- check jquery library included or not.
Comments
Post a Comment