$(this).data("id") code example
Example 1: data-item-id
// Here's our buttonvar button = document.getElementById('your-button-id'); // Get the valuesvar cmd = button.getAttribute('data-cmd');var id = button.getAttribute('data-id'); // Change the valuesbutton.setAttribute('data-cmd', yourNewCmd);button.setAttribute('data-id', yourNewId);
Example 2: data id
<li data-id="1234" data-email="[email protected]" data-age="21">Calvin</li>