weixin_33704234 2014-09-12 15:41 采纳率: 0%
浏览 22

确认密码验证[关闭]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
                </div>
            </div>
        </div>
                <hr class="my12 outline-none baw0 bb bc-powder-2">
            <div class="grid fw-nowrap fc-black-600">
                    <div class="grid--cell mr8">
                        <svg aria-hidden="true" class="svg-icon iconLightbulb" width="18" height="18" viewbox="0 0 18 18"><path d="M9.5.5a.5.5 0 0 0-1 0v.25a.5.5 0 0 0 1 0V.5zm5.6 2.1a.5.5 0 0 0-.7-.7l-.25.25a.5.5 0 0 0 .7.7l.25-.25zM1 7.5c0-.28.22-.5.5-.5H2a.5.5 0 0 1 0 1h-.5a.5.5 0 0 1-.5-.5zm14.5 0c0-.28.22-.5.5-.5h.5a.5.5 0 0 1 0 1H16a.5.5 0 0 1-.5-.5zM2.9 1.9c.2-.2.5-.2.7 0l.25.25a.5.5 0 1 1-.7.7L2.9 2.6a.5.5 0 0 1 0-.7z" fill-opacity=".4"></path><path opacity=".4" d="M7 16h4v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1v-1z" fill="#3F3F3F"></path><path d="M15 8a6 6 0 0 1-3.5 5.46V14a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1v-.54A6 6 0 1 1 15 8zm-4.15-3.85a.5.5 0 0 0-.7.7l2 2a.5.5 0 0 0 .7-.7l-2-2z" fill="#FFC166"></path></svg>
                    </div>
                <div class="grid--cell lh-md">
                    <p class="mb0">
                        <b>Want to improve this question?</b> <a href="/posts/25811995/edit">Update the question</a> so it's <a href="/help/on-topic">on-topic</a> for Stack Overflow.
                    </p>
                    <p class="mb0 mt6">Closed <span title="2014-09-13 04:54:48Z" class="relativetime">5 years ago</span>.</p>
                </div>
            </div>
    </aside>

I have an html file and I am trying to check two password field ( Password & conform Password), I have to use this particular form I can't use any sample, I have looked at examples here and I came a cross a working example and I tried to get it work but it's not working so far, i am new to this so please be patient with me on this

<div id="register" class="animate form">
 <form action="mysuperscript.php" autocomplete="on"> 
 <h1> Sign up </h1> 
 <p> 
 <label for="usernamesignup" class="uname" data-icon="u">Your username</label>
 <input id="usernamesignup" class="username" name="usernamesignup" required="required" type="text" placeholder="mysuperusername690">
 <span class="check"  ></span> 
 </p>
 <p> 
 <label for="emailsignup" class="youmail" data-icon="e"> Your email</label>
 <input id="emailsignup" name="emailsignup" required="required" type="email" placeholder="mysupermail@mail.com"> 
 </p>
 <p> 
 <label for="passwordsignup" class="youpasswd" data-icon="p">Your password </label>
 <input id="passwordsignup" name="passwordsignup" required="required" type="password" placeholder="eg. X8df!90EO">
 </p>
 <p> 
 <label for="passwordsignup_confirm" class="youpasswd" data-icon="p">Please confirm your password </label>
  <input id="passwordsignup_confirm" name="passwordsignup_confirm" required="required" type="password" onkeyup="checkPasswordMatch(); placeholder="eg. X8df!90EO">
  </p>
  <p class="signin button"> 
  <input type="submit" value="Sign up"> 
  </p>
  <p class="change_link">  
Already a member ?
  <a href="#tologin" class="to_register"> Go and log in </a>
</p>
</form>

I have added this function to the code

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
function checkPasswordMatch() {
    var password = $("#passwordsignup").val();
    var confirmPassword = $("#passwordsignup_confirm").val();

    if (password != confirmPassword)
        $("#register").html("Passwords do not match!");
    else
        $("#register").html("Passwords match.");
}
</script>

according to the example it should work but obviously I am doing something wrong here, appreciate your help.

</div>
  • 写回答

3条回答 默认 最新

  • 七度&光 2014-09-12 15:53
    关注

    This line is messed up.

     onkeyup="checkPasswordMatch(); placeholder="eg. X8df!90EO">
    

    Your double quotes are not matched.

    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘