Jquery 如何自定义所需弹出窗口的文本?
提交表单时,如果有必填字段未填写,则会出现一个自动弹出窗口,显示位置与字段相对:Jquery 如何自定义所需弹出窗口的文本?,jquery,css,html,Jquery,Css,Html,提交表单时,如果有必填字段未填写,则会出现一个自动弹出窗口,显示位置与字段相对: <form id="frm" action="<?php echo PAGE_SERVICE; ?>?action=ServiceAjouterAbonneExec" method="post" name="frm" enctype=""> <div class="toggle"> <table> <tr>
<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('entvalue Here')”
首先创建一个检查数据库的服务器端脚本,然后使用ajax调用该脚本,然后阅读HTML验证以及如何自定义这些错误消息,这并不难。是的,我知道这些步骤,但问题是弹出窗口:如何创建和显示它?快速搜索将向您展示如何执行该操作->因此这是浏览器的消息?是的,这是原生HTML5验证。
<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>