# Titlebar text from function

**URL:** <https://discourse.nodered.org/t/titlebar-text-from-function/26352>\
**Category:** Dashboard\
**Created:** [9 May 2020 08:52 UTC](https://discourse.nodered.org/t/titlebar-text-from-function/26352 "2020-05-09T08:52:24Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [9 May 2020 11:58 UTC](https://discourse.nodered.org/t/titlebar-text-from-function/26352/5 "2020-05-09T11:58:16Z")

</div>

From that old thread - this add a clock to teh ttlebar

> [@Set a logo in the title bar?](https://discourse.nodered.org/t/set-a-logo-in-the-title-bar/618/5):
>
> Clock code copied over from old mailing list to here This node (ui\_template) shows the time in the top bar: [{"id":"91670c03.c29ad","type":"ui\_template","z":"96082429.7476f8","group":"951f63e6.78df","name":"Clock Toolbar","order":6,"width":"0","height":"0","format":"\<script id=\"titleScript\" type=\"text/javascript\"\>\n $('#clock').remove();\n var toolbar = $('.md-toolbar-tools');\n var div = $('\<div/\>');\n var p = $('\<p/ id=\"clock\"\>');\n \n $('#titleScript').parent().hide(…

Which I see you may have already added - so add another - this time positioned in the middle and change the payload to be your message rather than the time.

something like

```auto
[{"id":"fe316fd6.b362d","type":"ui_template","z":"e4501ac7.9c41d8","group":"e0c3e8c1.0cc748","name":"Toolbar","order":6,"width":"0","height":"0","format":"<script id=\"titleScript\" type=\"text/javascript\">\n $('#titlewords').remove();\n var toolbar = $('.md-toolbar-tools');\n var div = $('<div style=\"text-align:center; width:100%;\"/>');\n var p = $('<p/ id=\"titlewords\">');\n \n $('#titleScript').parent().hide();\n div.append(p);\n toolbar.append(div);\n\n function displayTitle(lh) {\n p.text(lh); \n }\n\n // Watch the payload and update the title\n (function(scope) {\n scope.$watch('msg.payload', function(data) {\n displayTitle(data);\n });\n })(scope);\n</script>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":400,"y":480,"wires":[[]]},{"id":"e0c3e8c1.0cc748","type":"ui_group","z":"","name":"Garage","tab":"f5aa47bb.2a4d68","order":2,"disp":false,"width":"10"},{"id":"f5aa47bb.2a4d68","type":"ui_tab","z":"","name":"Garage","icon":"fa-car","order":1}]

```

---

_[View the full topic](https://discourse.nodered.org/t/titlebar-text-from-function/26352)._
