showElement

Category:UI Controls

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.

Examples

Blinking

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");
});

Syntax

showElement(id);

Parameters

NameTypeRequired?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 _.

Tips

Found a bug in the documentation? Let us know at documentation@code.org