This is probably simple but the answer alludes me at this time. I have a button that I have attached a data attribute to ('data-faqid')
clicking on links on the webpage changes this data then when I click that button I am trying to get the value like so
$('#faqSaveBtn').click(function () {
var aFAQID = $(this).data('faqid');
saveAClassFaq(aFAQID, sf);
});
My problem is this:
I click on the button once and the value seems fine. I click on other buttons that should change this data attribute and they seem to work when looking at the dom but the second and any other click always returns the value of the first time I clicked the button.
EDIT: I change the faqid with this bit of code - in other click events
$('#faqSaveBtn').attr('data-faqid', iFaqID);