how to change all td numeric values into percentage values in jquery and PHP -
i want function when click toggle button numeric values should changed percentage value formula.
<table class="table table-striped table-bordered scrollable"> <thead> <tr class="success"> <th>answer</th> <th>total</th> <th>pcp</th> <th>ob/gyn</th> <th>pain</th> </tr> </thead> <tbody><tr><td class="left-align">male</td> <td>123</td> <td>72</td> <td>18</td> <td>33</td> </tr><tr><td class="left-align">female</td> <td>78</td> <td>48</td> <td>22</td> <td>8</td> </tr><tr><td class="left-align">all respondent</td> <td>201</td> <td>120</td> <td>40</td> <td>41</td> </tr></tbody> </table>
my formula 201*value/100
. can tell way how can this.with php , jquery.any suggestion.
try this
$('table tr td').each(function () { var value = $(this).text(); if ($.isnumeric(value)) { var final = 201 * value/ 100; $(this).text(final) } });
Comments
Post a Comment