I want to rotate the entire table 90 degrees in a counterclockwise direction. i.e. the contents of td (row = i, column = jth) should be passed to td (row = (total number of rows-j + 1) th, column = i). The text inside the div should also be rotated 90 degrees.
<table><tbody> <tr><td>a</td><td>1</td><td>8</td></tr> <tr><td>b</td><td>2</td><td>9</td></tr> <tr><td>c</td><td>3</td><td>10</td></tr> <tr><td>d</td><td>4</td><td>11</td></tr> <tr><td>e</td><td>5</td><td>12</td></tr> <tr><td>f</td><td>6</td><td>13</td></tr> <tr><td>g</td><td>7</td><td>14</td></tr> </tbody></table>
this table should be converted to
<table><tbody> <tr> <td>8</td><td>9</td><td>10</td><td>11</td> <td>12</td><td>13</td><td>14</td> </tr> <tr> <td>1</td><td>2</td><td>3</td><td>4</td> <td>5</td><td>6</td><td>7</td> </tr> <tr> <td>a</td><td>b</td><td>c</td><td>d</td> <td>e</td><td>f</td><td>g</td> </tr> </tbody></table>
I can do this with javascript loops. But a very long time. I want to know if there is a more elegant way. Thanks in advance.
source share