jQuery中live()使用报错,TypeError: $(...).live is not a function(转) 2022-06-07 07:16 54阅读 0赞 # jQuery中live()使用报错,TypeError: $(…).live is not a function # <div class="article_manage clearfix"> <div class="article_r"> <span class="link_postdate">2017-03-02 16:01</span> <span class="link_view" title="阅读次数">761人阅读</span> <span class="link_comments" title="评论次数"> <a href="#comments" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_pinglun'])">评论</a>(0)</span> <span class="link_collect tracking-ad" data-mod="popu_171"> <a href="javascript:void(0);" onclick="javascript:collectArticle('jQuery%e4%b8%adlive()%e4%bd%bf%e7%94%a8%e6%8a%a5%e9%94%99%ef%bc%8cTypeError%3a+%24(...).live+is+not+a+function','59536781');return false;" title="收藏" target="_blank">收藏</a></span> <span class="link_report"> <a href="#report" onclick="javascript:report(59536781,2);return false;" title="举报">举报</a></span> </div> </div> <style type="text/css"> .embody{ padding:10px 10px 10px; margin:0 -20px; border-bottom:solid 1px #ededed; } .embody_b{ margin:0 ; padding:10px 0; } .embody .embody_t,.embody .embody_c{ display: inline-block; margin-right:10px; } .embody_t{ font-size: 12px; color:#999; } .embody_c{ font-size: 12px; } .embody_c img,.embody_c em{ display: inline-block; vertical-align: middle; } .embody_c img{ width:30px; height:30px; } .embody_c em{ margin: 0 20px 0 10px; color:#333; font-style: normal; } </style> <script type="text/javascript"> $(function () { try { var lib = eval("("+$("#lib").attr("value")+")"); var html = ""; if (lib.err == 0) { $.each(lib.data, function (i) { var obj = lib.data[i]; //html += '<img src="' + obj.logo + '"/>' + obj.name + " "; html += ' <a href="' + obj.url + '" target="_blank">'; html += ' <img src="' + obj.logo + '">'; html += ' <em><b>' + obj.name + '</b></em>'; html += ' </a>'; }); if (html != "") { setTimeout(function () { $("#lib").html(html); $("#embody").show(); }, 100); } } } catch (err) { } }); </script> <div class="category clearfix"> <div class="category_l"> <img src="http://static.blog.csdn.net/images/category_icon.jpg"> <span>分类:</span> </div> <div class="category_r"> <label onclick="GetCategoryArticles('6759992','sdfdyubo','top','59536781');"> <span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_fenlei']);">jQuery<em>(1)</em></span> <img class="arrow-down" src="http://static.blog.csdn.net/images/arrow_triangle _down.jpg" style="display:inline;"> <img class="arrow-up" src="http://static.blog.csdn.net/images/arrow_triangle_up.jpg" style="display:none;"> <div class="subItem"> <div class="subItem_t"><a href="http://blog.csdn.net/sdfdyubo/article/category/6759992" target="_blank">作者同类文章</a><i class="J_close">X</i></div> <ul class="subItem_l" id="top_6759992"> </ul> </div> </label> <label onclick="GetCategoryArticles('6759993','sdfdyubo','top','59536781');"> <span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_fenlei']);">Html<em>(1)</em></span> <img class="arrow-down" src="http://static.blog.csdn.net/images/arrow_triangle _down.jpg" style="display:inline;"> <img class="arrow-up" src="http://static.blog.csdn.net/images/arrow_triangle_up.jpg" style="display:none;"> <div class="subItem"> <div class="subItem_t"><a href="http://blog.csdn.net/sdfdyubo/article/category/6759993" target="_blank">作者同类文章</a><i class="J_close">X</i></div> <ul class="subItem_l" id="top_6759993"> </ul> </div> </label> <label onclick="GetCategoryArticles('6758438','sdfdyubo','top','59536781');"> <span onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_fenlei']);">javascript学习笔记<em>(1)</em></span> <img class="arrow-down" src="http://static.blog.csdn.net/images/arrow_triangle _down.jpg" style="display:inline;"> <img class="arrow-up" src="http://static.blog.csdn.net/images/arrow_triangle_up.jpg" style="display:none;"> <div class="subItem"> <div class="subItem_t"><a href="http://blog.csdn.net/sdfdyubo/article/category/6758438" target="_blank">作者同类文章</a><i class="J_close">X</i></div> <ul class="subItem_l" id="top_6758438"> </ul> </div> </label> </div> </div> # jquery中的live()方法在jquery1.9及以上的版本中已被废弃了,如果使用,会抛出`TypeError: $(...).live is not a function`错误。 解决方法: 之前的用法: .live(events, function) 新方法: .on(eventType, selector, function) 若selector不需要,可传入null 例子1: 之前: $(‘\#mainmenu a’).live(‘click’, function) 之后: $(‘\#mainmenu’).on(‘click’, ‘a’, function) 例子2: 之前: $(‘.myButton’).live(‘click’, function) 之后(应使用距离myButton最近的节点): $(‘\#parentElement’).on(‘click’, ‘.myButton’, function) 若不知最近的节点,可使用如下的方法: $(‘body’).on(‘click’, ‘.myButton’, function) # document.getElementById("bdshell\_js").src = "http://bdimg.share.baidu.com/static/js/shell\_v2.js?cdnversion=" + Math.ceil(new Date()/3600000) <div id="digg" articleid="59536781"> <dl id="btnDigg" class="digg digg_enable" onclick="btndigga();"> <dt>顶</dt> <dd>0</dd> </dl> <dl id="btnBury" class="digg digg_enable" onclick="btnburya();"> <dt>踩</dt> <dd>0</dd> </dl> </div> <div class="tracking-ad" data-mod="popu_222"><a href="javascript:void(0);" target="_blank"> </a> </div> <div class="tracking-ad" data-mod="popu_223"> <a href="javascript:void(0);" target="_blank"> </a></div> <script type="text/javascript"> function btndigga() { $(".tracking-ad[data-mod='popu_222'] a").click(); } function btnburya() { $(".tracking-ad[data-mod='popu_223'] a").click(); } </script> * * 文章版权声明:注明蒲公英云原创文章,转载或复制请以超链接形式并注明出处。
相关 Layui 报错:Uncaught TypeError: l.push is not a function layui,这个框架说实在的我用的并不熟悉。今天突然遇到了Uncaught TypeError: l.push is not a function 代码如下: 然后我又... 朱雀/ 2021年07月28日 16:19/ 1 赞/ 10379 阅读
相关 Angular 懒加载报错:TypeError:undefined is not a function 前言 Angular日常采坑 在Angular中尝试进行懒加载时,遇到以下错误: TypeError:undefined is not a 小鱼儿/ 2021年09月17日 09:48/ 0 赞/ 171 阅读
相关 js、jQuery出现$(...).live is not a function和$(...).size is not a function 在调试js时,控制台发现如下报错: ![在这里插入图片描述][20190825210946982.jpg] Uncaught TypeError: $(…).live 阳光穿透心脏的1/2处/ 2021年10月24日 09:50/ 0 赞/ 160 阅读
相关 TypeError: "_vm.onetopic is not a function" 解决方案 1、方法 onetopic要放在methods:\{\}里面 2、看看自己是不是多个\},导致方法在methods:\{\}外面了 ------------ 浅浅的花香味﹌/ 2022年02月01日 11:15/ 1 赞/ 140 阅读
相关 jQuery中live()使用报错,TypeError: $(...).live is not a function(转) jQuery中live()使用报错,TypeError: $(…).live is not a function <div class="article_ma 旧城等待,/ 2022年06月07日 07:16/ 0 赞/ 55 阅读
相关 jquery提交表单报错 Uncaught TypeError: s[y] is not a function 来源: http://stackoverflow.com/questions/29430416/typeerror-s-y-is-not-a-function-error 素颜马尾好姑娘i/ 2022年07月24日 16:07/ 0 赞/ 84 阅读
相关 jQuery—$ is not a function 昨天编写代码,在使用jQuery获取input值时浏览器控制台显示“$ is not a function”,查看自己写的代码,发现没有写错,于是查找各种资料, 以你之姓@/ 2022年08月21日 08:22/ 0 赞/ 43 阅读
相关 Hystrix Dashboard界面中jQuery报错Uncaught: TypeError: e.indexOf is not a function 1、问题描述 在使用Spring Cloud 整合Hystrix Dashboard组件监控Hystrix时控制台出现jQuery报错Uncaught: TypeEr ゝ一世哀愁。/ 2022年09月09日 08:25/ 0 赞/ 77 阅读
相关 webpack打包报错 [webpack-cli] TypeError: merge is not a function 报错信息如下: [webpack-cli] Failed to load '/Users/allard/Desktop/webpack-react-scaffol Love The Way You Lie/ 2022年09月15日 20:54/ 0 赞/ 120 阅读
相关 uni-app报错TypeError: this.getOptions is not a function ![在这里插入图片描述][20210217235434283.png] 解决办法: 1.npm uninstall less-loader 2.npm i 我会带着你远行/ 2022年10月30日 13:25/ 0 赞/ 30 阅读
还没有评论,来说两句吧...