javascript - How to show hidden div after hitting submit button in form? -
i have simple html form submit button. after hitting button see div#my_id
not visible before.
<input type="submit" name="xxx" value="yyy" onclick="document.getelementbyid('my_id').style.display = 'block' ;"> <div id="my_id" style="display: none"> text </div>
how can make work?
is html contained within <form>
tag? submit button submitting form , causing page refresh before javascript executed.
if case, try changing input type button see effect.
for example:
#my_id { display: none; }
<form> <input type="button" name="xxx" value=" show text! " onclick="document.getelementbyid('my_id').style.display = 'block' ;" /> <div id="my_id"> text </div> </form>
Comments
Post a Comment