I'm assigning an onclick evenlistener to each row of my table. However, whenever I click a row, the eventlistener for the last row get triggered instead of the eventlistener of the row I clicked. I know this because I am printing out on the console which element had their eventlistener triggered.
$(document).ready(function(){
for(var j = 0; j < tabs.length; j++){
var id = id_prefix + j;
var jqElem = $('#' + id);
var tab = tabs[j];
jqElem.click(function(){
console.log(jqElem);
//chrome.windows.update(tab.windowId, {"focused":true});
//chrome.tabs.update(tab.id, {"active":true});
//window.close();
});
}
});
Sung (Roger) Kim: UC Connan: OSX: HTML/Javascript (jQuery):
Description
I'm assigning an onclick evenlistener to each row of my table. However, whenever I click a row, the eventlistener for the last row get triggered instead of the eventlistener of the row I clicked. I know this because I am printing out on the console which element had their eventlistener triggered.
Screenshots
<If possible, include a screenshot>