I am looking for a circle through Dome and add an ID attribute to the current table element. This can not seem to work much. Basicaly code looks for a specific class table, then adds an ID, there will be more things depending on the class of tables, but at this time I got stuck on adding the ID. Any help would be greatly appreciated.
$ (document) .ready (function () {var chartTypeArray = []; var i = 0; // cycle tables id and store square $ add 'table') each (function I) {if ($ (this) .hasClass ('bar')) {chartTypeArray.push ('bar'); $ (this) .attr ('id', 'tableToChart' + I);} // and bar (If you are not sure about the 'line')) {chart type arrow pen ('line'); $ (this) .attr ('ID', 'tableToChart' + i);} // end line Other if ($ (this) .as class ('region')) {chart type arrow pen ('field'); $ (this) .attr ('id', 'tableToChart' + i);} // end area And if ($ (this) .hasClass ('pie')) {chart type array Not ('pie'); $ (this) .attr ('ID', 'tableToChart' + i);} / / end pie i ++; console.log ('Table' + I + 'a' + $ ( This is) .attr ('class') + 'chart');}); // end function});
Try less case
$ ( This) .attr ('id', 'tabletochart' + i);
You also do not have to
var i = 0; // // outside of each loop and you do not need i ++; //
inside each loop
Comments
Post a Comment