Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

Embed JS not firing

$
0
0

I have the following JavaScript, it finds a list items with a given value and changes their font color. It works when I run it in from the IE Developer Tools - Script debugger. Here is a code sample.

<SCRIPT type=text/javascript>
var colorCode = document.getElementsByTagName("td");
var i = 0;
for (i = 0; i < colorCode.length; i++) 
{
    if (colorCode[i].className == "ms-cellstyle ms-vb2") 
	{
        	if (colorCode[i].innerHTML == "Green") 
		{
        	    colorCode[i].style.color = 'Green';
	        }
        	if (colorCode[i].innerHTML == "Yellow") 
	        {
        	    colorCode[i].style.color = 'Yellow';
	        } 
      		if (colorCode[i].innerHTML == "Red")  
	        { 
        	 colorCode[i].style.color='Red'; 
	        }
    	} 
}</SCRIPT>

When I insert a Script Editor webpart and add the exact same code snippet nothing happens.

Any Ideas?


Viewing all articles
Browse latest Browse all 25064

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>