so I don't know if I'm doing it right, but I wanted to make a button with a link in the submit input, but I don't know how to do that, the code is like this
<form action="index.html" method="post">
<h1>Login</h1>
<input type="text" name="" placeholder="Usuario">
<input type="password" name="" placeholder="Insira Sua Senha">
<input type="submit" name="" value="Login">`in this part`
I tried to make a link with href and ul, I tried to create the button with div button, but it didn't stay in the position it was when I use the input.
CodePudding user response:
i am new contributor to, i hope to help answer your question, actually I'm not sure what you mean by "a button with a link in the submit input", maybe like this, you can change the type to button
<form action="index.html" method="post">
<h1>Login</h1>
<input type="text" name="" placeholder="Usuario">
<input type="password" name="" placeholder="Insira Sua Senha">
<input type="button" name="" value="Login" onclick="functionHere()">`in this part`
source : Html input type="button" - W3Schools
CodePudding user response:
I would remove the submit element entirely then. With a little bit of JavaScript, you can get anything to submit the form. It's not the most conventional way to go about things but it does exactly what you need it to do. If you wanted to pass any other data through the submit element, you can simply add invisible elements.
<form action="index.html" method="post" id="form">
<h1>Login</h1>
<input type="text" name="" placeholder="Usuario">
<input type="password" name="" placeholder="Insira Sua Senha">
<div onclick="document.getElementById("form").submit()">
<p>Login</p>
<a href="link.html">Link</a>
</div>
</form>