I have a div
in HTML with a and I want the content of this to change select
when calling a JavaScriptdiv
function , after doing several things in my JavaScript code . I want this to go away select
and a table to pop up that I'll populate using JavaScript to change the content.
Can I somehow have a div
hidden with the table until I disable the div
with select
and enable the div
with the table?
It would be to change the content of the div
with id=loggedin
(the table that is in that div
is not the one that I want to fill, that I use to place the select
).
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="loggedin">
<div id="header">
Logged in to as <span id="fullName"></span>
<a id="disconnect" href="#">Log Out</a>
</div>
<div id="output"> </div>
<table id=tabla style="width:100%">
<tr> </tr> <tr> <th> </th> </tr>
<tr> </tr> <tr> <th> </th> </tr>
<tr>
<th>
<select class="select" id="boards"></select>
</th>
</tr>
</table>
<span id="res"> nada</span>
<span id="res2"> nada</span>
<span id="res3"> nada</span>
</div>
For a div to change dynamically by javascript you have to do the following:
DOM
The style of the with is usually handledCSS
, in your case you want to hide onediv
you can do it with:To show one
div
that is hidden you can do it with javascript :To hide one
div
that is visible you can do it with javascript :To change the content of one
div
you can do it with the DOM property :innerHTML
I hope this clears your doubts ;))...