Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 2
How to create the hidden text and show that when i click any button. With button type and tag div is a target. JavaScript..
<input type="button" value="Tampil"> That a button </input>. And show in <div id="target"> </div>ā¦
10 Respostas
+ 6
U can initially have CSS for target as:
#target{
display:none;
}
Later attach a onclick on your button
var showDiv = function (){
document.getElementById("target").style.display = 'block';
}
+ 6
bro chechout my codes
+ 4
It works. U can post ur code for reference if not working for u :)
+ 3
U can check the value of display and alternatively flip it on button click
var showDiv = function (){
var div = document.getElementById("target");
if(div.style.display==='none')
div.style.display= 'block';
else
div.style.display= 'none';
}
+ 3
<input type="button" onClick="showDiv()" value="answer">
U need to execute showDiv() within onclick.
+ 1
and how i show again? whit the same of button.
+ 1
Thanks for your answer, i tryed but i can't see the respons of a button when i click. :(
0
my html code:
<h5> Do you tired? </h5>
<input type="button" onClick="showDiv" value="answer"></input>
<div id="target"> Yes iam tired now </div>
my css code:
#target {
display:none;
}
my js code:
var showDiv = function(){
document.getElementById("target").style.display='block';
}
where my mistakes.?
0
yeah.. that run. Thanks Ashwani Kumar. iam sorry but i just litle english. so, i think i can do how to hidden the text... where are you from.?
0
@Suyash. that a beautyfull circle, can i save your code bro?