Help please. When I click the button, nothing happens. Here is my code:
type: custom:button-card
name: GetMeOutOfHere
tap_action:
action: javascript
actions: >
[[[
alert('I am an alert box!');
]]]
Help please. When I click the button, nothing happens. Here is my code:
type: custom:button-card
name: GetMeOutOfHere
tap_action:
action: javascript
actions: >
[[[
alert('I am an alert box!');
]]]
Thanks @Didgeridrew . I managed to get this working. What I really wanted to do was make a logout button with a confirmation. Here's the working code:
type: custom:button-card
name: GetMeOutOfHere
tap_action:
action: perform-action
perform_action: browser_mod.javascript
data:
code: >
let text = "Are you sure you want to log out?\n\nClick OK to continue, or
Cancel.";
if (confirm(text) == true) {
hass.auth.revoke();
hass.connection.close();
window.localStorage.clear();
document.location.href = '/';
} else {
text = "You cancelled!";
}