hideElement

Category:UI Controls

hideElement(id)

Hides the element with the provided id so it is not shown on the screen.

The user interface elements you place on the screen are 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 hidden.

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

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

hideElement(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 _.

Returns

No return value. Modifies display only.

Tips

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