I’m using a JavaScript code that it suppose to show a hidden DIV, but somehow i have to push twice in order for that DIV to appear.
JavaScript code:
function AddComp() {
HideComp();
$("#Add-Com").click(function () {
$("#hide").toggle("fast", function () {
$('#hide').css({ visibility: "visible", height: "auto" });
});
});
var a = document.getElementById("divSave");
a.onclick = InsertComp;
}
function HideComp() {
$('#hide').css({ visibility: "hidden", height: "0" });
$("#Name").val("");
$("#Address").val("");
$("#Email").val("");
}
in HTML i have this:
<div id="Add-Com" onclick="AddCom()">
<span>Add Company</span></div>
<div id="hide" style="visibility: hidden; height: 0px;"> .....the code
Can anyone help me?
The default status is hidden. I want want to toggle it by clicking once.
Thanks
It seems that this do the trick the way I want it