html - Holding data in contenteditable tables -


if have simple html table, enabling contenteditable on table data. possible have formula across table (for example: cell 1 column 1 + cell 2 column 1 = cell 3 column 1) , contenteditable change variables in formula , updata totals?

i playing little bit contenteditable:

http://jsfiddle.net/nmhms/440/

below simple function can use desired results. , here updated fiddle http://jsfiddle.net/nmhms/441/

plus can add infinite number of columns , rows , dynamically put total in last row

function updatetotal(){      var totalcols=$("#table tr").eq(0).find("td").length-1;     var toalrows=$("#table tr").length-1;     var cellvalue=0;      for(var col=0;col<=totalcols; col++){          for(var row=0;row<=toalrows; row++){               if(row!=toalrows)                          cellvalue+= parseint($("#table tr").eq(row).find("td").eq(col).text());               if(row==toalrows){                  $("#table tr").eq(row).find("td").eq(col).text(cellvalue);                 cellvalue=0; // reset cell value              }            }      }           } 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -