(function($, window, document) {}) jQuery 调用解决与其他javascript库冲突的写法
将函数包在红色字体内部,可以解决$符号与其他插件的冲突。
<script type="text/javascript">
(function($, window, document) {
//$(document).ready(function(){
var param_cats = $("input[name='category[]']:checked").val();
if(param_cats == null || param_cats == '') {
param_cats = '0';
}
else {
$('#ehp-topblogs-title').html('Top Blogs in ' + $("input[name='category[]']:checked").next().html() + ':');
// $('#ehp-topblogs-title').html('Top Blogs in All Categories:');
}
var post_data_top_loved = {
action: 'top_loved',
item_cats: param_cats,
top_loved_nonce: top_loved_vars.nonce
};
$.post(top_loved_vars.ajaxurl, post_data_top_loved, function(response) {
$('#divBlogsGroup').html(response);
$('#span-blog-loading').delay(1500).hide();
});
// });
})(jQuery, window, document);
</script>
(function($, window, document) {}) jQuery 调用解决与其他javascript库冲突的写法的更多相关文章
- jQuery避免$符和其他JS库冲突的方法对比
1.如果jquery库在第三方库之后引用.这个时候jquery库会占用$. 解决办法:剔除$符号的使用权. <script type="text/javascript" sr ...
- jQuery noConflict() 方法----与其他javaScript插件冲突时
1,全名代替----jQuery: $.noConflict(); jQuery(document).ready(function(){ jQuery("button").clic ...
- 【原】IOS合并lib(.a)库的终极可用方法(可用于解决duplicate symbol静态库冲突)
网上流传了太多关于合并lib库的方法,自己也尝试过,但大多失败.有感于这种急于解决问题,经过百般尝试后依旧无果的无奈心情,小翁在这里用一个实例来完整阐述如何在mac中合并lib静态库. 这里以移动广告 ...
- JS (function (window, document, undefined) {})(window, document)的真正含义
原文地址:What (function (window, document, undefined) {})(window, document); really means 按原文翻译 在这篇文章中,我 ...
- 详解jquery插件中;(function ( $, window, document, undefined )的作用
在jquery插件中我们经常看到以下这段代码 1 2 3 ;(function ( $, window, document, undefined ){ //函数体内具体代码 })(jQuery, wi ...
- 详解;(function ($,window,document,undefined){...})(jQuery,window,document);
1.代码最前面的分号,可以防止多个文件压缩合并以为其他文件最后一行语句没加分号,而引起合并后语法错误. 2.匿名函数(function(){})();:由于Javascript执行表达式是从圆括号里面 ...
- jquery插件中(function ( $, window, document, undefined )的作用
在jquery插件中我们经常看到以下这段代码 ;(function ( $, window, document, undefined ){ //函数体内具体代码 })(jQuery, window,d ...
- 详解jquery插件中(function ( $, window, document, undefined )的作用。
1.(function(window,undefined){})(window); Q:(function(window,undefined){})(window);中为什么要将window和unde ...
- ;(function($,window,document,undefined){})(jQuery,window,document)
;(function($,window,document,undefined){})(jQuery,window,doucment) 1.自调函数(function(){})() 2.好处是不会产生任 ...
随机推荐
- (三)策略模式-C++实现
策略模式:定义一系列算法,把它们一个个封装起来,并且使它们可以相互替换,本模式使得算法可独立于使用它的客户而变化. 三种角色: 1.策略:一个抽象类,这个接口定义了若干个算法标识,即多个虚函数,这些个 ...
- Apache和Tomcat区别
Apache 和 Tomcat 都是web网络服务器,两者既有联系又有区别,在进行HTML.PHP.JSP.Perl等开发过程中,需要准确掌握其各自特点,选择最佳的服务器配置.Apache是web服务 ...
- 使用exp进行SQL报错注入
0x01 前言概述 好消息好消息-作者又在MySQL中发现了一个Double型数据溢出.如果你想了解利用溢出来注出数据,你可以读一下作者之前发的博文:BIGINT Overflow Error bas ...
- Visual Studio各版本工程文件之间的转换
转载于:http://www.cnblogs.com/jmliao/p/5594179.html 由于VS版本比较多,低版本无法直接打开高版本的工程文件,通过对工程文件进行一些修改可以解决这些问题. ...
- 阴影效果css
http://www.cssreflex.com/css-generators/ http://blog.csdn.net/freshlover/article/details/7610269 css ...
- Swift中的Masonry第三方库——SnapKit
在OC开发时我常用一个名叫Masonry的第三方Autolayout库,在转Swift后发现虽然Swift可以混编OC,但总感觉有些麻烦,在Github上发现了这个叫做SnapKit的第三方库,发现使 ...
- Asp.net NVelocity 模版引擎
NVelocity.dll是Java中常用的一个模版,下面是常用的模版引擎 1,返回string类型的html代码 /// <summary> /// 获取html模版 /// </ ...
- 表单验证——JavaScript和Jquery版
1.轻量级的JavaScript表单验证 在应用中引用 validator.min.js 文件 <script type="text/javascript" src=&quo ...
- C#.NET 大型通用信息化系统集成快速开发平台 4.0 版本 - 拆分表、联系方式的拆分?
当用户数据有接近10万时,而且多表的关联也比较频繁时,能把大表拆为小表,也会提高系统的性能,I/O.运算性能.当然以后用户数据会更大可能会到30-40万以上,所有有能力时适当拆表,分分合合,合合分分也 ...
- codevs 3165 爱改名的小融2
3149 爱改名的小融 2 http://codevs.cn/problem/3149/ 题目描述 Description Wikioi上有个人叫小融,他喜欢改名.现在他的要求变了,只要是英文字母就是 ...