Another Javascript , probobly for you minor problem , but i just can not understand how to fix it , googled all night for it , problem is simple … i have table and inside td’s i got buttons and i assigned onclick event on all of them , so when i click a button i do a function and at the end of function i want to change that event to go for another function
here is my code …
var $UserRow = $(Final).closest('tr').clone();
$('td button', $UserRow).each(function () {
this.removeEventListener('click', GetInfo, false);
this.addEventListener('click', GetBetslip, false);
});
$UserRow.appendTo('#UserTicket');
So $UserRow is a row that i want to copy to another table and that part is working fine , but before i copy it i want to remove all button events … i have tried with everything from
this.removeEventListener('click',GetInfo,false);
this.detachEvent('Click', GetInfo);
this.onclick = GetBetslip;
this.onclick = function () { GetBetslip()};
i just do not know what to try anymore … can you just help me out … all i want is to change event for every button inside that tr.
It looks like you are using jQuery, if that is the case you are looking for this function.
$().off()According to the comments you might do better with this: