jQuery click event not working after adding class

前端 未结 7 1785
臣服心动
臣服心动 2020-11-22 01:47

In my JSP page I added some links:

Organization Data


        
7条回答
  •  猫巷女王i
    2020-11-22 02:30

    on document ready event there is no a tag with class tabclick. so you have to bind click event dynamically when you are adding tabclick class. please this code:

    $("a.applicationdata").click(function() {
        var appid = $(this).attr("id");
    
       $('#gentab a').addClass("tabclick")
        .click(function() {
              var liId = $(this).parent("li").attr("id");
             alert(liId);        
          });
    
    
     $('#gentab a').attr('href', '#datacollector');
    
    });
    

提交回复
热议问题