Solved

Change the visibility of an HTML textbox.

Posted on 2011-09-18
7
413 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

707 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

12 Experts available now in Live!

Get 1:1 Help Now