Link to home
Start Free TrialLog in
Avatar of Rassac
RassacFlag for Malta

asked on

Change / Hide text field on click

Hi,

I have the below code which works well to show the hidden text field but once the field is changed to inline-block it cannot be reverted back to hidden.

Can you please provide suggestions? Thanks.
function Change(){
if (document.getElementById( "myId" ).style.display = "none")
	{
		document.getElementById( "myId" ).style.display = "inline-block"; 
	}
else
 
if (document.getElementById( "myId" ).style.display = "inline-block")
	{
		document.getElementById( "myId" ).style.display = "none"; 
	}
}
 
<BODY>
 
<tr>
 
<td>
<input type="button" onclick="Change();" value="Click Me">
</td>
 
<!--<input type="button" onclick="Hide();" value="Java Hide"> -->
 
<td><input type=text id="myId" style="display:none"></input></td>
 
</tr>
 
</BODY>
</HTML>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rassac

ASKER

thanks :)
you are welcome