doonbfez815298 2016-10-25 07:16
浏览 270
已采纳

点击的功能在adminLTE上对我不起作用

I got this problem about all night. I will click button and I got nothing data or alert. Please help me. And so Sorry for my bad English.I'll try to learn.

  
 $(document).ready(function() {
     $("#test-click").on("click",function() { 
        alert('1');
     });
 });
  
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button type="button" id="test-click">testClick</button>

</div>
  • 写回答

2条回答 默认 最新

  • duanbairan4235 2016-10-25 07:20
    关注

    Yes OfCourse! your code is not working. because .on() event comes after jquery 1.7.x versions. Please use .live() event instead of .on() event. Or else use latest jquery version.

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
    <script>
        $(document).ready(function(){
        $("#test-click").live("click",function(){ 
            alert('1');
        });
        });
    
    </script>
    <button type="button" id="test-click">testClick</button>

    </div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求TYPCE母转母转接头24PIN线路板图
  • ¥100 国外网络搭建,有偿交流
  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型