Using .data() method for storing the info on DOM nodes


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $("div").data("myName", 'addy');
  2. $("div").data("myName") === 'addy';
  3.  
  4. /* Here are two ways to remove all of the information
  5. bound to an element*/
  6. $("div").removeData();
  7. $("div").remove();
  8.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.