data-id for option code example

Example 1: data-item-id

// Get the valuesvar cmd = $('#your-button-id').attr('data-cmd');var id = $('#your-button-id').attr('data-id'); // Change the values$('#your-button-id')    .attr('data-cmd', yourNewCmd)    .attr('data-id', yourNewId);

Example 2: 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);