I'm trying to set a data-attr dinamically to 12 elements mapped by 12 buttons, so <button data-id="_id01"> will display <div data-id="_id01">,
I'm trying to select the button like
$('.button').data('id').click(function() {
console.log('this is the button' + data.id);
})
the button and the div shall recieve the same data-, so when I click btn 01, it will toggle div01, and so on..
how ecxactly shall I reference this in the jquery?
data('id')is going to return a String. You cannot call.click()on a string