Shows the element with the provided id.
The user interface elements you place on the screen on not static. Your app sometimes needs to move, resize, hide or show them. All UI elements (button()
, textInput()
, textLabel()
, dropDown()
, checkBox()
, radioButton()
, image()
), can be shown.
Make the Code.org logo blink.
// Make the Code.org logo blink. image("logo", "http://code.org/images/logo.png"); setInterval(function() { hideElement("logo"); setTimeout(function() { showElement("logo"); }, 500); }, 1000);
image("logo", "http://code.org/images/logo.png"); button("hideButton", "Hide logo"); button("showButton", "Show logo"); onEvent("hideButton", "click", function(event) { hideElement("logo"); }); onEvent("showButton", "click", function(event) { showElement("logo"); });
showElement(id);
Name | Type | Required? | Description |
---|---|---|---|
id | string | The ID of the UI element to which this event handler applies. Must begin with a letter, contain no spaces, and may contain letters, digits, - and _. |
hideElement()
is often used with showElement()
.Found a bug in the documentation? Let us know at documentation@code.org