Is there a way using javascript to change the display of a form after it as been rendered?

I won’t to remove a checkbox on a form if a certain condition is true.

Since this case is not the norm, the default rendering displays the checkbox even though it’s not a valid selection.

And the check I guess would have to come when the link to display the form is clicked.

Any ideas??


Thanks

Recommended Answers

All 3 Replies

you can use the style property 'display' to show/hide elements in your web page. Its pretty simple, if you give content that you want to manipulate an id:

// to hide
document.getElementById("yourDivOrElementId").style.display = 'none';

// to show
document.getElementById("yourDivOrElementId").style.display = 'block';

Thanks that worked for input element. Is there a way to hide elements that don't have an id? I have a label for the input element that looks like this

<label for"sameIDasInput">LableText</label>

I just put everything that needed to be modified on the fly between a div tag like so

<div ID="test0" style="visibility:visible">

With the visibility set.

I used javascript to update the visibility.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.