javascript - Show new field after button click -
i want make field shows after button click.
heres code far:
<div class="control-group" style="display:none" id="passwordfield"> <label class="control-label">password:</label> <div class="controls"><input id="pw" type="password"></div> </div>
the "display:none" makes invisible, after have button , javascript should change display "block", making visible again.
<div style="padding-left: 160px;padding-bottom:20px"> <button class="btn btn-primary" onclick="showpwfield()">log-in</button> <script> function showpwfield() { document.getelementbyid("passwordfield").style.display = "block"; } </script> </div>
but doesnt work. function gets called tested alert, can't change style :/
thanks in advance
the error getelementbyid
not exist, should use getelementbyid
:
function showpwfield() { document.getelementbyid("passwordfield").style.display = "block"; }
<div class="control-group" style="display:none" id="passwordfield"> <label class="control-label">password:</label> <div class="controls"><input id="pw" type="password"></div> </div> <div style="padding-left: 160px;padding-bottom:20px"> <button class="btn btn-primary" onclick="showpwfield()">log-in</button> <script> function showpwfield() { document.getelementbyid("passwordfield").style.display = "block"; } </script> </div>
Comments
Post a Comment