make submit button disappear when clicked
Simply add :
button.style.visibility = "hidden";
at the end of your SetInput
function.
how to make a button appear disappear on click of another button?
Your conditional rendering is good, the problem comes when you are updating your show
state , so in your handleShow
function make a little change
handleshow() {
this.setState ((prevState) => {
return {
show : !prevState.show
}});}
Plus, change the type submit of show button to type button.
That will do the trick.
How to make rect's disappear and re-appear using onclick buttons
It appears you define r1
, r2
, and r3
in go1
so they are undefined in go2
and go3
.
One solution would be to add
let r1, r2, r3;
above all functions and then within go1
change
let r1 =
to r1 =
and do the same for the other two r
variables.
Also I think you need to change onclick="go1"
to onclick="go1()"
and do the same for the other two click handlers.
I'd highly recommend fixing your indentation. Good indentation makes problems like this much easier to see. If you find it hard to indent your code properly, try using https://beautifier.io/.
How do I make a button disappear after a certain amount of clicks
Assign id
to your button.<Button id='myButton' onclick="myFunction()">
On every click of button, keep incrementing the counter (I think you know how to do it)
After the counter is reached,document.getElementById("Your_button_id_here").style.visibility = "hidden";
<script>
var counter=0;
function myFunction() {
//increment counter
counter+=1;
if(counter>4)
document.getElementById("Your_button_id_here").style.visibility = "hidden"
}
</script>
However, I think disabling would be more proper:document.getElementById("Your_button_id_here").disabled=true
Related Topics
Nsobject Subclass in Swift: Hash VS Hashvalue, Isequal VS ==
Alamofire Get API Request Not Working as Expected
What Is the Purpose of Willset and Didset in Swift
Swiftui: How to Make Textfield Become First Responder
How to Resolve "Ambiguous Use Of" Compile Error With Swift #Selector Syntax
How to Convert a Date String With Optional Fractional Seconds Using Codable in Swift
Waiting Until the Task Finishes
Swift - How to Convert String to Double
Passing an Array to a Function With Variable Number of Args in Swift
Swiftui Hstack With Wrap and Dynamic Height
Examples of Delegates in Swift
How to Enumerate an Enum With String Type
Do Swift-Based Applications Work on Os X 10.9/Ios 7 and Lower
How to Use String.Substringwithrange? (Or, How Do Ranges Work in Swift)
How to Dispatch_Sync, Dispatch_Async, Dispatch_After, etc in Swift 3, Swift 4, and Beyond