# How set the output variable "{{msg.payload}}" in JS?!

**URL:** <https://discourse.nodered.org/t/how-set-the-output-variable-msg-payload-in-js/657>\
**Category:** General\
**Created:** [7 June 2018 09:41 UTC](https://discourse.nodered.org/t/how-set-the-output-variable-msg-payload-in-js/657 "2018-06-07T09:41:32Z")\
**Posts on this page:** 1\
**Showing post:** 33

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [4 September 2018 15:28 UTC](https://discourse.nodered.org/t/how-set-the-output-variable-msg-payload-in-js/657/33 "2018-09-04T15:28:20Z")

</div>

The short answer is that you cannot access `msg.payload` directly from inside your browser's `<script>...</script>` elements -- please read through the answers given on [this recent discussion thread](https://discourse.nodered.org/t/battery-gauge-load-msg-payload-into-javascript-resolved/2639).

---

_[View the full topic](https://discourse.nodered.org/t/how-set-the-output-variable-msg-payload-in-js/657)._
