So I'm working on a site with one main page containing a table and buttons to control the selected rows in the table. Each row in the table has a button with either a + or a - depending on whether the user has clicked it or not. It starts as a +, then when clicked it adds an identifier unique to that row to an array. The buttons have an ID equal to the unique identifier.
I want the table to auto-refresh every 10 seconds, but when I do, it resets all buttons to + because that's what is in the HTML.
I'm trying to get it to reset the already selected ones to minuses based on the array with this code:
function refreshTable(){
$('#tablefill').load('table.php', function(){
setTimeout(refreshTable, 10000);
});
$.each(selected, function(index, value) {
document.getElementById(value).innerHTML = '-';
});
}
I'm not too experienced with jQuery, so I'm sure I'm just missing something. Let me know if I should include any other code.
selected?document.getElementById(value).innerHTMLif you can$('#' + value).html(...)?valuewill be each row, not a unique identifier. Please clarify.