AnsweredAssumed Answered

Use Java Script in a Jive document

Question asked by hbaris on Mar 12, 2015
Latest reply on Mar 14, 2015 by hbaris

Hi all,

 

We're made a nice table to help us manage our project. We created the table is in HTML, due to the lack of many basic features in Jive's default menu.

I wanted to add another simple JavaScript to color some cells with a color code to indicate their current status. ("Approved" cell will be color in Green, for example)

 

The JS is simple, but yet- I can't make it work in Jive for some reason:

(The table is only as an example, obviously...)

<html>

<head></head>

<body>

    <table>   

    <tr><td>PRD 1</td><td>In Work</td></tr>

    <tr><td>Feature 2</td><td>Review</td></tr> 

    <tr><td>Bug 3</td><td>Approved</td></tr> 

    <tr><td>SRS 4</td><td>Updated</td></tr>   

    </table>

<script>

    var td = document.getElementsByTagName("td");

var i = 0, tds = td.length;

for (i; i < tds; i++) {

    if (td[i].innerHTML == "In Work") {

        td[i].setAttribute("style", "background:#f52b2b;");

    }

    if (td[i].innerHTML == "Review") {

        td[i].setAttribute("style", "background:#ffcb4f;");

    }

    if (td[i].innerHTML == "Approved") {

        td[i].setAttribute("style", "background:#6af03b;");

    }

    if (td[i].innerHTML == "Updated") {

        td[i].setAttribute("style", "background:#6bb1ff;");

    }

}

</script>

</body>

</html>

 

In the real world- working smoothly. In Jive some tags are being messed and nothing works..

Can any one help?

 

Many thanks!

Outcomes