我有一个问题。我必须让我的错误消息显示在窗体之外,但我不知道如何制作它,因为我的javascript正在显示消息,当错误消息类在窗体中时。是否有可能使其超出形式? 这是图片,看起来如何。在此示例中,我想在红色按钮下方显示错误。1
<form class="ui form" id="companyForm" style="margin-top:1em">
<div class="two fields">
<div class="field">
<input type="text" name="companyName" placeholder="Company name">
</div>
<div class="field">
<input type="text" name="companyCode" placeholder="Company code">
</div>
</div>
<div class="field">
<input type="text" name="companyAddress" placeholder="Company address">
</div>
<div class="ui error message"></div>
</form>
<div class="ui bottom attached red button" onclick="submitForm(this);">
<p><b>Place order</b> <i class="large shop icon"></i></p>
</div>
<div class="ui error message"></div>
function submitForm(){
var formValidationRules2 =
{
companyName: {
identifier: 'companyName',
rules: [
{
type : 'minLength[2]',
prompt : 'Your Company name must be at least {ruleValue} characters'
}
]
},
companyCode: {
identifier: 'companyCode',
rules: [
{
type : 'minLength[4]',
prompt : 'Your Company code must be at least {ruleValue} characters'
}
]
},
companyAddress: {
identifier: 'companyAddress',
rules: [
{
type : 'minLength[10]',
prompt : 'Your Company address must be at least {ruleValue} characters'
}
]
}
}
$("#companyForm").form(formValidationRules2);
$("#companyForm").form('validate form');
if($("#companyForm").form('is valid')){
joooo();
}
}