+ 4
I want to make button with div
when I will click in button my div will show I think I can do it with display none and block after in div I will have a two input type text and one button (ok)when I will write text in both text area and will click my ok button text will show in second div which will open when I will click my Ok button
9 odpowiedzi
+ 13
I want to help you but i didn't understand anything, can you write your question with more clarity? Maybe with an example of what you want to do.
If you want to create a toggle effect with a div, yeah... you can make it with the display property.
If you want to display a div when you click on the submit button, yeah... you can make it with the onsubmit() function in Javascript.
+ 6
<div>
<input type="button" name="any" value="button" />
</div>
the answer is very simple try it and enjoy it..
+ 6
What's your question ? I think you have done it, the way you are approaching is correct.
On click of button, you have to get the value of input box and set it to innerHTML of div element. Also, this is the point you will set the display: block property of div.
[Edit]:
JS part:
//function called on click of button
function showText(){
var div = document.getElementById('your_div_id');
div.style.display = 'block';
div.innerHTML = document.getElementById('your_input_id').value;
}
+ 5
@Kristina see my edited answer. You will get an idea.
+ 3
second answer just type
<div>
<button> My Button </button>
</div>
very simple
+ 2
guys first in html we have a button with dive
star my div will have a none display after when I will click in button my div will show
+ 2
div have a two text input and one button ok
when I will write text in inputs and doing ok button my text will add my second new div
+ 2
I want to know how working javascript only
+ 2
Yeah have but after I will add it my code