使用语义ui的HTML表单:
<div class="ui form" action="send.php" method="POST">
<div class="field">
<label>Name</label>
<div class="ui left labeled input">
<input name="name" type="text" placeholder="Dries Roelvink">
<div class="ui corner label">
<i class="icon asterisk"></i>
</div>
</div>
</div>
<div class="field">
<label>Email</label>
<div class="ui left labeled input">
<input name="email" type="text" placeholder="dries@roelvink.nl">
<div class="ui corner label">
<i class="icon asterisk"></i>
</div>
</div>
</div>
<div class="field">
<label>Message</label>
<textarea name="message"></textarea>
</div>
<input class="ui blue submit button" type="submit" name="submit" value="Send"/>
</div>
我的jquery文件:
$('.ui.form')
.form({
name: {
identifier: 'name',
rules: [
{
type: 'empty',
prompt: 'Please enter a name.'
}
email: {
identifier: 'email',
rules: [
{
type: 'empty',
prompt: 'Please enter a valid email.'
}
message: {
identifier: 'message',
rules: [
{
type: 'empty',
prompt: 'Please enter your message.'
}
]
}
})
;
我正在尝试使用jquery文件检查我的表单,而不是将其提交到我的php文件。由于某种原因,我的提交按钮不起作用,我不知道如何将此表单提交给任何file.php?
请帮忙!
答案 0 :(得分:0)
要以标准HTML方式提交表单,请尝试将<div>
更改为<form>
<form class="ui form" action="send.php" method="POST">
<div class="field">
<label>Name</label>
<div class="ui left labeled input">
<input name="name" type="text" placeholder="Dries Roelvink">
<div class="ui corner label">
<i class="icon asterisk"></i>
</div>
</div>
</div>
<div class="field">
<label>Email</label>
<div class="ui left labeled input">
<input name="email" type="text" placeholder="dries@roelvink.nl">
<div class="ui corner label">
<i class="icon asterisk"></i>
</div>
</div>
</div>
<div class="field">
<label>Message</label>
<textarea name="message"></textarea>
</div>
<input class="ui blue submit button" type="submit" name="submit" value="Send"/>
</form>
这应该毫无问题地提交给您的send.php
,首先必须通过jQuery验证才能发送表单。