# \<script\> tags in templates for Tests script not working

**URL:** <https://community.postman.com/t/script-tags-in-templates-for-tests-script-not-working/29006>\
**Category:** Help Hub\
**Tags:** tests, template, javascript\
**Created:** [October 22, 2021, 10:19am UTC](https://community.postman.com/t/script-tags-in-templates-for-tests-script-not-working/29006 "2021-10-22T10:19:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasannaKul](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@prasannaKul](https://community.postman.com/u/prasannaKul)\
**Post date:** [October 22, 2021, 10:19am UTC](https://community.postman.com/t/script-tags-in-templates-for-tests-script-not-working/29006/1 "2021-10-22T10:19:29Z")

</div>

Hi all,  
I am trying to create a very simple Tests script, which can display response text. Here my \<span\> tag works fine, but I don’t get the console log in \<script\> tag. The console log outside the template works fine, also if I save the template contents as HTML, it prints the \<script\> tag console log. But it is not working with POSTMAN. Please help in the resolution.

My Tests script contents are as below.

```auto
var template = `

<script>console.log('test in template');\</script>

<span style="white-space: pre-line">{{result}}\</span>

`;

var jsonData = JSON.parse(responseBody);

result = jsonData.result

console.log('test: in test');

pm.visualizer.set(template, {

    // Pass the response body parsed as JSON as `data`

    result: result

});

```

Thanks,  
prasanna

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [April 30, 2025, 4:17pm UTC](https://community.postman.com/t/script-tags-in-templates-for-tests-script-not-working/29006/2 "2025-04-30T16:17:15Z")

</div>

Closed on April 30, 2025, 4:17pm UTC


