当提交表单并且有未填写的必填字段时,将会有一个自动弹出窗口显示在相对于该字段的位置:
<form id="frm" action="<?php echo PAGE_SERVICE; ?>?action=ServiceAjouterAbonneExec" method="post" name="frm" enctype="">
<div class="toggle">
<table>
<tr>
<td><b><?php echo _getText("admin.login.form.titre");?></b></td>
<td><input type="text" name="login" id="login" maxlength="25" required /></td>
</tr>
<tr>
<td><b><?php echo _getText("admin.mdp.form.titre");?></b></td>
<td><input type="password" name="mdp" id="mdp" maxlength="50" required /></td>
</tr>
...
<tr>
<td colspan="2" align="right" ><input name="btnValider" id="btnValider" type="submit" value="<?php echo _getText("main.valider");?>" class="btn btn-blue"/></td>
</tr>
</table>
</div>
</form>
我想在用户输入数据库中已存在的登录名时显示类似的弹出窗口。怎么做?
最佳答案
您可以使用 oninvalid="this.setCustomValidity('Enter Value Here')"
<form id="form">
<input name="test" required placeholder="Required value" oninvalid="this.setCustomValidity('Enter Value Here')" oninput="setCustomValidity('')" />
<input type="submit" name="submit" value="submit" />
</form>
关于jquery - 如何自定义所需弹出窗口的文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24886726/