繁体   English   中英

第二个 JQuery 代码不起作用

[英]2nd JQuery Code not working

我有两个代码,如果添加第一个,第二个不起作用,我不确定问题出在哪里以及如何解决,以下是页面页脚中使用的代码:

代码 1:

<script type="text/javascript">
$(document).ready(function () {
    var names = ["input.name","input.first_name","input.last_name","input.email","input.address","input.city","input.state","input.zip","input.phone","input.country"];
    $.each(names,function (index, item) {
        var regex = new RegExp("\\{\\{"+item+"\\}\\}","g");
        var currVal = localStorage.getItem("garlic:"+document.location.host+"*>"+item);
        $("body:contains('{{"+item+"}}')").each(function() {
            var replace_text = (currVal != null) ? currVal : "";
            var replaced = $(this).html().replace(regex, replace_text);
            $(this).html(replaced);
        });
    });
});
</script>

代码 2:

<script type="text/javascript">

$(document).ready(function(){
    $('#agreeCheckbox').click(function(){
        $('#tmp_button-70655').toggle();
        $('#disablebtn').toggle();

});


$('#agreeCheckboxtwo').click(function(){
        $('#button-99411-155-131-111').toggle();
        $('#disablebtntwo').toggle();

});
  });
</script>

您是否尝试删除“就绪”之一?

<script type="text/javascript">
$(document).ready(function () 
{
    var names = ["input.name","input.first_name","input.last_name","input.email","input.address","input.city","input.state","input.zip","input.phone","input.country"];
    $.each(names, function (index, item) 
    {
        var regex = new RegExp("\\{\\{"+item+"\\}\\}","g");
        var currVal = localStorage.getItem("garlic:"+document.location.host+"*>"+item);
        $("body:contains('{{"+item+"}}')").each(function() 
        {
            var replace_text = (currVal != null) ? currVal : "";
            var replaced = $(this).html().replace(regex, replace_text);
            $(this).html(replaced);
        });
    });

    $('#agreeCheckbox').click(function()
    {
        $('#tmp_button-70655').toggle();
        $('#disablebtn').toggle();

    });

    $('#agreeCheckboxtwo').click(function()
    {
            $('#button-99411-155-131-111').toggle();
            $('#disablebtntwo').toggle();
    });
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM