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.

  1. check html doctype. should <!doctype html>
  2. check javascript console possible errors
  3. check jquery library included or not.

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -