Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to create textfield,before click the button i want to set div visibility hidden,after click the button,i want to visible div.How it possible,i want some sample code.
Posted

1 solution

Look this sample code

XML
<html>
<head>
<script type = "text/javascript">
<!--
function hide(x) {
document.getElementById(x).style.display='none';
}
function show(x) {
document.getElementById(x).style.display='';
}
//-->
</script>
</head>
<body>
<input type="button" value="Show" onClick="show('divBioBottom')">
<input type="button" value="Hide" onClick="hide('divBioBottom')">
<br>

Line 1<br>
<div id="divBioBottom">
content
</div>
Line 3<br>
</body>
</html>


Sample code for creating text box dynamically in javascript

<html>
<head>
<title>Dynamic Form</title>
<script language="javascript">
function changeIt()
{
var i = 1;
my_div.innerHTML = my_div.innerHTML +"<br><input type='text' name='mytext'+ i>"

}
</script>
</head>
<body>

<form name="form" action="post" method="">
<input type="text" name=t1>
<input type="button" value="test" onClick="changeIt()">
<div id="my_div"></div>

</body>
</html>
 
Share this answer
 
v3
Comments
DeepthiTanguturi 24-Dec-11 6:50am    
at the same time i want to create new teextfiled.
Sridhar Patnayak 24-Dec-11 6:52am    
You want to create it dynamically?
Sridhar Patnayak 24-Dec-11 6:59am    
If you want to create it dynamically, look the modified code

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900