Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
// Store data $("#userCard").data("userId", 42); $("#userCard").data("role", "admin"); // Retrieve data const id = $("#userCard").data("userId"); // 42 const role = $("#userCard").data("role"); // "admin" // Remove data $("#userCard").removeData("userId");
Result
Open