How to shuffle a particular td every refresh the page? I have this mc examination and I like to give a twist that every refresh the choices will shuffle, but the mc type I have is inside table..
I have a shuffle row, but I don’t know how to shuffle the particular td.
Here’s my code
var el
function togCell(col, asn) {
if (typeof event !== 'undefined')
el = event.srcElement
for (var i = 0; i < el.parentNode.cells.length; i++)
el.parentNode.cells[i].style.backgroundColor = '';
el.style.backgroundColor = col;
}
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #ededed;
}
<table>
<tr>
<th>Question</th>
<th>A</th>
<th>B</th>
<th>C</th>
</tr>
<tr>
<td>TESTING FIRST QUESTION</td>
<td onclick="togCell('#90ee90','AnsSelected_1')">FIRST Choices Correct</td>
<td onclick="togCell('#90ee90','AnsSelected_1')">FIRST Choices Wrong</td>
<td onclick="togCell('#90ee90','AnsSelected_1')">FIRST FIRST Choices Wrong</td>
</tr>
<tr>
<td>TESTING SECOND QUESTION</td>
<td onclick="togCell('#90ee90','AnsSelected_1')">SECOND Choices Wrong</td>
<td onclick="togCell('#90ee90','AnsSelected_1')">SECOND Choices Wrong</td>
<td onclick="togCell('#90ee90','AnsSelected_1')">SECOND Choices Correct</td>
</tr>
</table>