1
所以我有一个表单有两个字段,其中一个字段需要有信息才能成功显示下一页。我将如何禁用提交按钮,直到该字段中有一些文本?禁用提交按钮,直到字段有文本?
这里是HTML代码;
<div id="content">
<form action="avatarquery.php" method="POST" id="login-form">
<fieldset>
<p>
<label for="login-username">Server Name:</label>
<input type="text" id="login-username" name="name" class="round full-width-input" autofocus />
</p>
<p>
<label for="login-password">Server IP:</label>
<input type="text" id="login-password" name="ip" class="round full-width-input" />
</p>
<input class="button round blue image-right ic-right-arrow" type="submit" id="register" />
</fieldset>
<br/><div class="information-box round">Please Note: Some servers may not work due to their Configs not having Query Enabled.</div>
</form>
您将需要使用JavaScript有提交按钮“启用”。但是,HTML5引入了“required”属性,可以帮助您。 – George
谢谢!我忘了HTML5需要:) – Cwtch22