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 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀