1

I am trying to add a custom JS to toggle stacktrace info. However block is not getting visible. [![enter image description here][1]][1]

Trying to pass the block to step details <td>

 private String genStackTraceLink(String stackTrace){
        String stackTraceLnk = "";
        int iRandTraceCntr = 0;
        if (!stackTrace.isEmpty()) {
            iRandTraceCntr = new Random().nextInt(10000);
            stackTraceLnk = "<br><a href=\"#div" + iRandTraceCntr + "\" onclick=\"var el=getElementById('div"
                    + iRandTraceCntr + "');"
                    + "(el.style.display=='none')? (el.style.display='block') : (el.style.display='none'); "
                    + "(this.text == '+ Show stack trace')? "
                    + "(this.text='- Hide stack trace') : (this.text='+ Show stack trace'); this.style.fontSize='small'\"><font size='1'>+ Show stack trace</font></a>"
                    + "<div id=\"div" + iRandTraceCntr + "\" style=\"display:none\"><pre>" + stackTrace
                    + "</pre></div>";
            return stackTraceLnk;
        }
        return Globals.GC_EMPTY;
    }
souvikd
  • 31
  • 3
  • I would recommend using CSS class 'hide' on the code block. Use js to toggle this class on click. – Anshoo Jan 20 '17 at 06:30

0 Answers0