mac007 Posted April 24, 2009 Share Posted April 24, 2009 Hi all: I am pretty new at this javascipt stuff; so I have this simple script where the "onclick removeChild" doenst work as expected? I have to click twice for it to delete each field; also, how can I make it so when clicking the "remove text field" button, it only deletes, let's say text field "one", and not keep on deleting form elements?? Thanks! <html> <head> </head> <body> <script language="JavaScript"> function function2() { myList.removeChild(myList.firstChild); } </script> <input type="button" value="Remove Text field!" onClick="function2();" > <form id="myList" action="" method="get"> <input name="one" type="text" id="one"> <input name="two" type="text" id="two"> <input name="" type="submit"> </form> <br> <br> output text: <?php echo $_GET["one"]. ", " . $_GET["two"]; ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/155528-onclick-removechild-doenst-work-as-expected-have-to-click-twice-for-it-to-work/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.