Web

HTML, JavaScript snippets

Simple input form <!DOCTYPE html> <html> <head> <title>The name at tab</title> </head> <body> <h1>First section - h1</h1> <p>First paragraph</p> <form action="/action_page.php"> <label for="fname">First input:</label> <input type="text" id="first_input" name="input_1"><br><br> <label for="lname">Second input:</label> <input type="text" id="second_input" name="input_2"><br><br> <input type="submit" value="Text on button"> </form> </body> </html> You should write action_page.php further. When tou click the button, it passes to /action_page.php?input_1=fistbox&input_2=secondbox. Add text script <p id="p1"></p> <script> let p_element = document.getElementById("p1"); p_element.innerHTML = "Sample text" </script> TypeScript in browser Note: it doesn’t work for me and returns the error below.