【问题标题】:click event not working after hide and show jquery隐藏和显示jquery后单击事件不起作用
【发布时间】:2022-12-19 21:54:59
【问题描述】:

当关闭按钮X出现数据但链接点击事件不起作用。请帮我解决这个问题

发送前的 Ajax

beforeSend: function () {
                    $(".preloader").css({ 'display': 'flex' });
                    $(".tabscrltp").hide();
                },

单击当前数据隐藏并显示上一个

$(document).on("click", "#closeCrltpCt2", function (e) {
$(".tabsContentcrltp").empty();
$(".tabscrltp").show();
$("#closeCrltpCt2").hide();
});

【问题讨论】:

    标签: jquery ajax


    【解决方案1】:

    您是否将代码包装在$( document ).ready() 中?在操作 DOM 之前,您需要准备好它。

    $(document).ready(function() {
      $(document).on("click", "#closeCrltpCt2", function (e) {
        $(".tabsContentcrltp").empty();
        $(".tabscrltp").show();
        $("#closeCrltpCt2").hide();
      });
    });
    

    jQuery $( document ).ready()

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-11
      • 1970-01-01
      • 1970-01-01
      • 2012-12-29
      相关资源
      最近更新 更多