Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You have a much better chance of getting your question answered if you clean up the formatting, and ask a clear question. To clarify, do you want to dynamically set it to a predefined class that has the font attributes you're trying to set on it, or is it enough to change the item's "style" attribute to have these elements?</p> <p>At the very least, your checkbox will need some javascript attached to it. This would be an example of the input generated for row 1 of the table--row 2 would have "t_row_2", etc. (all generated by PHP).</p> <p>Put this script somwhere in a header:</p> <pre><code>&lt;script type="text/javascript"&gt; function setClass(chkbox,row_id){ row = document.getElementById(rowid); if(row){ if(elem.checked){ row.setAttribute("class","checkedClassName"); }else{ row.setAttribute("class","uncheckedClassName"); } } } &lt;/script&gt; </code></pre> <p>This is what the input should would look like using this method:</p> <pre><code>&lt;input type="checkbox" id="chk" onclick="setClass(this,'t_row_1)" /&gt; </code></pre> <p>If you're not afraid to play a little more with the javascript, and assuming your checkbox is within the tr in question, you can get rid of the row id parameter with a "getParentTr" function:</p> <pre><code>&lt;script type="text/javascript"&gt; function getParentTr(elem){ parent = elem.parentNode; while(parent !== document.body){ if(parent.type === "tr"){ return parent; } } return null; &lt;/script&gt; </code></pre> <p>Then you would remove the second parameter from the "setClass" function above, and replace "row = document.getElementById(rowid);" with "row = getParentTr(elem);"</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload