I have a form like
<input type="text" name="test" value="">
<input type="submit" name="submit" value="Send">
When I press the Enter button I want it to do create a new line in text box (br) but Enter key triggers the submit and it submits the value instantly. How can I solve this issue?
What you want is probably the
<textarea>element instead of<input>. The syntax is a little different, with the main difference being that there is notypeattribute, and instead the “value” goes between the opening and closing tag:Note that
rows="1"is simply to emulate<text>. If you want to allow newlines, you should probably use a higher value for that attribute.