'How can I clear a write("message")
Basically, I have a button that write("message"+myVar). Then I want to press a button that will delete the written message, but not mess with the variable at all.
I am very new to coding. I code on Code.org which is powered by javascript.
Much thanks
Solution 1:[1]
Welcome to SO. Always try to share your code so anyone can help you better. As much as I understand there are lots of ways to achieve this. The most straightforward one could be to create a textLabel with an empty string and then modify it with the setText property of code.org. Like so;
var myVar = "something";
textLabel("messageId","");
button("createButton", "create");
onEvent("createButton", "click", function( ) {
setText("messageId", "message" + myVar);
});
button("deleteButton", "delete");
onEvent("deleteButton", "click", function( ) {
setText("messageId",myVar);
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Cengiz |
