Hi, I am not sure if this question relates to Javascript or more to Jquery. And it seems really simple but I am stuck.
I am trying to assign a javascript variable to a jquery DataTables function. After debugging, the problem lies in counter++ not functioning as it should.
[script]
//Not working
var counter = 0;
function testfunction(){
addTab("addNewTab");
counter++;
alert(counter);
//counter shown as 1
}
$(function() {
var newId = "#table" + counter;
$(newId).live('dblclick', function () {
alert("test");
});
});
[/script]
$("#table") refers to a table id in my html. However, this does not work. The below version works instead.