0

Multiple tables contain data in cells. If I change the data in a cell, they should also be changed in the same cell in other tables.

<table id="1"><tr><td data-class="row1_col1"><input...></td><td data-class="row1_col2"><input...></td>...<td data-class="rowx_coly"><input...></td></tr></table>

var dataClass   = $(this).data("class");
var dataChk     = this.checked;
$("[data-class]").each(function(){
    if( $(this).attr("data-class") == dataClass){
        do the magic:-)
    }   
});

But these solution is very slowly for big datas.

Is there a other way like:

$(this).data("class", dataClass ).each(function(){
    do the magic :-)
});

or a other solution? Best thanks for helping

payam_sbr
  • 1,428
  • 1
  • 15
  • 24
Severin
  • 183
  • 2
  • 15

1 Answers1

1
$("[data-class='" + dataClass + "']").each(function(){ 
    // Do magic!
});

DataClass is a variable. It works great also with big data sets.

Severin
  • 183
  • 2
  • 15