How to display a hidden container in a web form by using JavaScript

How to display a hidden container in a web form by using JavaScript

  

Hi All, 

1. CNAcademic is a container contain an editable table list and default set to display =  false

2. A button called "BMSave" was created to enable the display of the CNAcademic container.

3. add an javascript function JSShowAcadTabl() to execute trigger by "BMSave"

4. I'm not sure the syntax of javascript to enable the display of container is correct or not. "document.getElementsByName("CNAcademic")[0].display = True"

Anyone know what's the problem I have got ?  thanks in advance.



Hi pwktommy,

You can give the container a style class, for example, "TextContainer", and then, inside the javascript of the screen, inside those functions, you can hide it with: 

SyntaxEditor Code Snippet

$(".TextContainer").hide(); 

And show it with:

SyntaxEditor Code Snippet

$(".TextContainer").show(); 


There are several ways other than this to hide and show the container with javascript. This is just one of the examples.

Best regards.

The question is though why you would want JavaScript for it, instead of using an If and an Ajax Refresh.

Kilian Hekhuis wrote:

The question is though why you would want JavaScript for it, instead of using an If and an Ajax Refresh.

If you really need javascript for this, I guess this will make the trick:

document.getElementsByName('CNAcademic')[0].style.visibility = 'visible';