Javascript examples for DOM HTML Element:Input Submit
append text to action type and perform submit operation in HTML
<html> <head></head> <body> <form onsubmit="myFunction(event);" method="POST"> <input type="text" name="myResource"> <input type="submit" value="Submit"> </form> <script> function myFunction(event) {/*from www . java2s . c o m*/ event.preventDefault(); const myResourceID = event.target.querySelector("[name=myResource]").value; event.target.setAttribute("action", "http://localhost:8080/downloads/" + myResourceID); event.target.submit(); } </script> </body> </html>