sharepoint - Javascript - Need to Work With Elements With Generic Classes -
i have javascript written accommodate needs conditional formatting on sharepoint page. there few tables, in web parts, in making changes style of of cells. used nodelist accomplish needs (no unique ids), , working alright, until changes made table threw nodelist references off (i knew inevitable..). wondering if has input on how better select or distinguish between elements have same class name , contain data change.
example:
<td class="asd"> blah blah blah </td> <td class="asd"> content content </td> <td class="asd"> test test test </td>
select them using getelementsbyclassname()
var tds = document.getelementsbyclassname('asd'); console.log(tds); (var = 0; < tds.length; i++) { tds[i].style.color = 'green'; }
<table> <tr> <td class="asd">blah blah blah</td> <td class="asd">content content</td> <td class="asd">test test test</td> </tr> </table>
Comments
Post a Comment