I have a few variables
var itemCount = 0;
var pageCount = 0;
var groupCount = 0;
Along with those variables, I have three buttons with data attributes that match these three variables
<button type="button" data-toggle="modal" data-target="#activeQ" data-count="item">ITEM</button>
<button type="button" data-toggle="modal" data-target="#activeQ" data-count="page">PAGE</button>
<button type="button" data-toggle="modal" data-target="#activeQ" data-count="group">GROUP</button>
What I want to do is each time I click a specific button, it increments that variable, ex. I click the ITEM button, itemCount adds 1.
I thought I had the function correct, but when I click it, the count is not incrementing (I am displaying some other information in a modal popup as well):
$('#activeQ').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget);
var aCat = button.data('count');
var theCount = eval(aCat+"Count");
theCount++;
console.log(theCount);
});