Login Form

<!doctype html> <html lang ="en"> <head> <title>document.forms example</title> </head> <body> <form id="dave"> <input type="button" onclick="alert(document.forms[0].id); " value="dave's form"/> </form> <form name="login"> <input name="email" type="email"> <input name="password" type="password"> <button type="submit">Log in</button> </form> <script> var loginform = document.forms.login; //or documents.forms['login'] loginform.elements.email.placeholder ='test@example.com'; loginform.elements.password.placeholder ='password'; </script> </body> </html>
The Document property forms returns a collection (an HTMLCollection) listing all the <form> elements contained by the document.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.