# Clickable logo image in css

**URL:** <https://discourse.nodered.org/t/clickable-logo-image-in-css/47465>\
**Category:** Dashboard\
**Created:** [22 June 2021 07:29 UTC](https://discourse.nodered.org/t/clickable-logo-image-in-css/47465 "2021-06-22T07:29:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![noBody](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nobody/32/33322_2.png) [@noBody](https://discourse.nodered.org/u/noBody)\
**Post date:** [22 June 2021 07:29 UTC](https://discourse.nodered.org/t/clickable-logo-image-in-css/47465/1 "2021-06-22T07:29:24Z")

</div>

Hi,  
I am setting logo for my UI dashboard using this code.

```auto
<style>
     .md-toolbar-tools{
         background-image: url("/logo.png");
         background-repeat:no-repeat;
         background-position:right top;
         background-size: 90px 39px;
    }
    .md-toolbar-tools h1{
        text-align: right;
        /*width: 250px;*/
    }
</style>

```

How to make that clickable, say make it send payload "true" when clicked ?

Thanks,

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 June 2021 07:40 UTC](https://discourse.nodered.org/t/clickable-logo-image-in-css/47465/2 "2021-06-22T07:40:55Z")

</div>

> [@noBody](#):
>
> How to make that clickable, say make it send payload "true" when clicked ?

You could do it with JavaScript in a ui template node.

Using JQuery to attach a click event is `$(".selector").on("click", function() {...})`  
where `.selector` is the thing you want clickable and `...` is the code to run.

The ui\_template node has built in help on how to send from dashboard to node-red. But to point you in the right direction, you call `scope.send( { payload: "some value" } );`

* * *

Here are some Search Terms to help you find additional help on the forum

- `jquery on click`
- `scope.send`

---

<div class="post-metadata">

**Author:** ![noBody](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nobody/32/33322_2.png) [@noBody](https://discourse.nodered.org/u/noBody)\
**Post date:** [22 June 2021 10:02 UTC](https://discourse.nodered.org/t/clickable-logo-image-in-css/47465/3 "2021-06-22T10:02:15Z")

</div>

Thank you. I am new to this, so please bear with me.

This is what I tried:

```auto
<style>
     .md-toolbar-tools{
         background-image: url("/logo.png");
         background-repeat:no-repeat;
         background-position:right top;
         background-size: 90px 39px;
    }
    .md-toolbar-tools h1{
        text-align: right;
        /*width: 250px;*/
    }
</style>

<!--<a class="md-toolbar-tools" ng-click="send({payload: 'true'})"></a>
-->

<script> 
$(".md-toolbar-tools").on("click", function() {scope.send( { payload: "true" } )});
/*$ (scope.send( { payload: "true" });*/
</script>

```

Click works with:  
`<a class="md-toolbar-tools" ng-click="send({payload: 'true'})"></a>`  
but only when the ui\_template is inside a Group, not when added to the `<head>` section. Adding it to a group misplaces it from its top right corner.

I tried some combinations inside `<script>` as above but couldn't get it to work.

Thanks

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 June 2021 11:13 UTC](https://discourse.nodered.org/t/clickable-logo-image-in-css/47465/4 "2021-06-22T11:13:41Z")

</div>

scope is not avaiable in head template.

You can add a normal template then hide it...

```auto
<script>
(function(scope) {
    const _scope = scope;
    $(".md-toolbar-tools").on("click", function() {
        _scope.send( { payload: "true" } )
    });

    //hide this card. NOTE: a960b1e5.8aec is the Node id as seen in the INFO panel on the sidebar
    $('[node-id="a960b1e5.8aec"]').hide(); 
  });
})(scope);
</script>

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [22 July 2021 11:14 UTC](https://discourse.nodered.org/t/clickable-logo-image-in-css/47465/5 "2021-07-22T11:14:17Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
