jquery - How to open another submit form after submitting one on html or javascript? -
i trying open form inputs after submitting one. in code, want edit node in array , getting first input make program find node edit. if input valid -the input 1 of nodes in array-, want open on same place first one. how can that?
<p> <a href="#" style="font-size: 20px" onclick="toggle_visibility('editnodeform');">edit existing node</a> </p> <form action="#" style="display: none;" id="editnodeform">id or name: <input type="text" id="toedit" size="20" style="width: 50%; height: 2em;"> <br /> <br /> <button type="button" class="mybutton" form="editnodeform" style="width: 50%;" onclick="editexistingnode();">submit</button> <br /> <br /> </form>
what put fields inside form, , separate steps divs.
on page load, hide steps (except first one). after clicking button, next step gets displayed.
the last step won't have button, submit button, making fire form.
$(function() { $('form>div:not(:first)').hide(); /* hide first step */ $('form').on('click', 'button', function(e) { e.preventdefault(); var currdiv = $(this).parent() , nextdiv = parent.next('div'); $(currdiv).hide(); $(nextdiv).show(); }); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <form> <div> step 1 / 3 add value: <input type="text" /><br /> <button>next step</button> </div> <div> step 2 / 3 add value: <input type="text" /><br /> <button>next step</button> </div> <div> step 3 / 3 add value: <input type="text" /><br /> <input type="submit" value="save form" /> </div> </form>
Comments
Post a Comment