检查HTML表单表明按钮不是表单的一部分
下面是检查HTML表单表明按钮不是表单的一部分,html,Html,下面是标记中的HTML内容 <div class="container mt-5 pt-2 pb-4" id="container-primary"> <div class="container mt-3" id="container-secondary"><h3>Welcome</h3><br> Please Enter your <strong&g
标记中的HTML内容
<div class="container mt-5 pt-2 pb-4" id="container-primary">
<div class="container mt-3" id="container-secondary"><h3>Welcome</h3><br> Please Enter your <strong>Password</strong> to view the question</br>
</div>
<div class="container pt-2" id="container-tertiary">
<form method="post" id="pwd-form" autocomplete="off">
<input type="password" class="form-control mx-auto" id="pwd" placeholder="Password" name="pwd" spellcheck="false"></input>
<div class="container" id="pwd-error-container"><?php
session_start();
if (isset($_SESSION['wrongpwd'])){
echo $_SESSION['wrongpwd'];
unset($_SESSION['wrongpwd']);
} ?>
</div>
<div class="container mx-auto" id="button-container">
<input type="submit" class="btn btn-info float-left" id="forgotpwd" value="Forgot Password">
<input type="button" class="btn btn-info float-right" id="submit-button" value="Validate" disabled>
</div>
</form>
您的html代码无效。您有不需要的结束标记,并且缺少其他需要的结束标记。这是一个更正的版本
#容器主{
背景色:;
}
#集装箱二次{
背景色:;
文本对齐:居中;
}
#容器三级{
背景色:;
文本对齐:居中;
边缘顶部:30px;
}
#pwd表格{
背景颜色:绿色;
}
#pwd{
宽度:40%;
最小宽度:300px;
字号:18px;
垫面:1px;
垫底:1px;
}
#pwd错误容器{
背景色:;
字号:19px;
颜色:rgb(217,48,37);
字体大小:粗体;
}
#按钮容器{
边缘顶部:25px;
宽度:40%;
最小宽度:300px;
边缘底部:25px;
}
#问题表格{
不透明度:0.3;
}
#答复{
宽度:40%;
最小宽度:300px;
字号:18px;
垫面:1px;
垫底:1px;
利润率最高:5%;
}
欢迎
请输入密码查看问题
这是您的html。您可以在代码段中清楚地看到表单标记是红色的,即它没有关闭。问题在于您的和标签/br>应仅为且标记不会使用
欢迎
请输入您的密码查看问题
从按钮中删除您的float left和float right类。然后它就可以正常工作了
<div class="container" id="button-container">
<div class="row">
<div class="mr-auto">
<button type="submit" class="btn btn-info" id="forgotpwd">Forgot Password</button>
</div>
<div class="">
<button type="button" class="btn btn-info" id="submit-button" disabled>Validate</button>
</div>
</div>
</div>
忘记密码
验证
呈现的HTML是什么样子?@janitha[URL]@Kumar将背景色添加到表单中,并检查发生了什么。@janitha@janitha我添加了背景色,它只添加到密码输入字段中。我想您可能添加了最后两个结束div。但当我们去检查的时候,这并不重要。但是,正如我从代码片段中看到的,您的代码看起来非常好,但我的代码并不好。唯一的区别是头部。当我从代码中删除所有jQuery、引导链接时,它工作得很好。因此,可能是jQuery或Bootstrap导致了问题
<div class="container" id="button-container">
<div class="row">
<div class="mr-auto">
<button type="submit" class="btn btn-info" id="forgotpwd">Forgot Password</button>
</div>
<div class="">
<button type="button" class="btn btn-info" id="submit-button" disabled>Validate</button>
</div>
</div>
</div>