Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Change the visibility of an HTML textbox.

Posted on 2011-09-18
7
Medium Priority
?
438 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
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…

618 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