I have read about 10-15 different similar * questions but none seems to do it for me so I figured I'll get my issue out there.
我已经阅读了大约10-15个不同类似的*问题,但似乎没有人为我这样做,所以我想我会在那里得到我的问题。
I have this html:
我有这个HTML:
<form>
<input type="search"/>
</form>
Which creates a textarea, if I then click inside of this textarea and type something (don't need to) and then clicks enter the form (with textarea) dissapears on the second attempt I click enter everytime.
这会创建一个textarea,如果我然后单击此textarea内部并键入内容(不需要)然后单击输入表单(使用textarea)第二次尝试时消失,我每次单击输入。
Same goes if I use type="submit"
.
如果我使用type =“submit”也是如此。
What happends is that page reloads and then form is gone. Note that I need to have the type as search and cant change it to anything else.
发生的事情是页面重新加载然后表单消失了。请注意,我需要将类型设置为搜索,并且无法将其更改为其他任何内容。
I've tried the preventdefault()
in the javascript trying to deny page reload without any further success.
我试过javascript中的preventdefault()试图拒绝页面重新加载而没有任何进一步的成功。
How do I make to it so that the form doesn't dissapear when clicking enter?
如何点击进入以使表单不会消失?
1 个解决方案
#1
Really weird interaction in your problem, but you can always do <form onSubmit="return false;">
在您的问题中真的很奇怪的互动,但你总是可以做
And then when you want to submit the from, you need to do it through some other method.
然后当你想提交from时,你需要通过其他方法来完成。
#1
Really weird interaction in your problem, but you can always do <form onSubmit="return false;">
在您的问题中真的很奇怪的互动,但你总是可以做
And then when you want to submit the from, you need to do it through some other method.
然后当你想提交from时,你需要通过其他方法来完成。