Solved

Change the visibility of an HTML textbox.

Posted on 2011-09-18
7
415 Views
Last Modified: 2012-05-12
I am able to hide a textbox by doing:
var tb1 = document.getElementById(id);
tb1.style.display = "none";

However, I am not able to make it visible by doing this:
tb1.style.display = "";

Please let me know what I could be missing. Thanks!
0
Comment
Question by:dshrenik
  • 4
  • 3
7 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 36557979
use : tb1.style.display = "block";
0
 

Author Comment

by:dshrenik
ID: 36557991
Still does not work. :(
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 36558010
if your textbox is set with : Visible="false"

<asp:Textbox runat="server" id="Texbox1" Visible="false" Text="blabla" />

the textbox DON'T EXIST in the page so you can ask javascript to show it

use :

<asp:Textbox runat="server" id="Texbox1" style="display:none"  Text="blabla" />
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 500 total points
ID: 36558012
another possible problem :

<div style="display:none">
<asp:Textbox runat="server" id="Texbox1" Text="blabla" />
</div>

you CAN'T SHOW it here too because the div around it is hidden
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36558032
<< the textbox DON'T EXIST in the page so you CAN'T ask javascript to show it >>
0
 

Author Comment

by:dshrenik
ID: 36558084
I am actually creating an HTML textbox through JavaScript.
0
 

Author Comment

by:dshrenik
ID: 36558093
I think the textbox is inside  a <td>, and I have set:
<td style="display: none">

Phew!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now