如何更改此JavaScript? [英] how to change this javascript?

查看:58
本文介绍了如何更改此JavaScript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的复选框点击中使用这个javascript onclick方法..但它不起作用,因为我把这个方法放在我的html源页面中..





am using this javascript to onclick method in my checkbox click.. but it is not working thats y i put this method in my html source page..


<script type="text/javascript">
       $(function () {
           $("#show_password").bind("click", function () {
               var txtPassword = $("#password");
               var txtnewpassword = $("#");
               if ($(this).is(":checked")) {
                   txtPassword.after('<input onchange = "PasswordChanged(this);" id = "txt_' + txtPassword.attr("id") + '" type = "text" value = "' + txtPassword.val() + '" readonly = "readonly" />');
                   txtPassword.hide();


               } else {
                   txtPassword.val(txtPassword.next().val());
                   txtPassword.next().remove();
                   txtPassword.show();
               }
           });
       });

</script>










<div class="edit-rght-2">
    <input type="password" disabled="disabled" value="sevika" 

        id="password" maxlength="10" readonly="readonly" /><input type="checkbox" id="show_password"  önclick="show_password();"/><label>Show</label>
</div>

推荐答案

(function(){
(function () {


(#show_password)。bind(click,function(){
var txtPassword =
("#show_password").bind("click", function () { var txtPassword =


(#password );
var txtnewpassword =
("#password"); var txtnewpassword =


这篇关于如何更改此JavaScript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆