Learning Path
浏览 jQuery 相关教程与章节。
HTML、CSS、JavaScript、浏览器 API、前端框架与 UI 工程。
教程
353
jQuery.isPlainObject()方法 jQuery 杂项方法 实例 判断一个对象是否是纯粹的对象。 [mycode3 type='javascript'] $(function () { function fun( html ){ document.body.innerHTML += '' + html; } fun($.isPlainObject({}))..
jQuery.isWindow()方法 jQuery 杂项方法 实例 判断传入的参数是否为 window对象 [mycode3 type='javascript'] window 是一个窗口吗? $(function () { $('b').append( '' + $.isWindow(window) ); }) [/mycode3] 尝试一下 » ..
jQuery.isXMLDoc()方法 jQuery 杂项方法 实例 判断一个对象是否在一个 XML 文档中 [mycode3 type='javascript'] $(function () { function fun( html ){ document.body.innerHTML += '' + html; } fun($.isXMLDoc(document))..
jQuery jQuery.Deferred() 方法 jQuery 杂项方法 定义和用法 $.Deferred() 是一个构造函数,用来返回一个链式实用对象方法来注册多个回调,并且调用回调队列,传递任何同步或异步功能成功或失败的状态。 提示:1. $.Deferred() 构造函数创建一个新的 Deferred(延迟)对象, jQuery.Deferred 可传递一个可选的函数,该函数在构造方法返回之前被调用并传递一个新的 Def..
jQuery jQuery.htmlPrefilter() 方法 jQuery 杂项方法 实例 从传入HTML字符串中删除所有标签 [mycode3 type='javascript'] $(function() { var htmlPrefilter = $.htmlPrefilter, rdel = /])[\w\W]*?/gi; $.htmlPrefilter = function( html )..
jQuery jQuery.readyException() 方法 jQuery 杂项方法 实例 传递接受到的错误给 console.error [mycode3 type='javascript'] jQuery.readyException = function( error ) { console.error( error ); }; [/mycode3] 定义和用法 $.readyE..
jQuery jQuery.speed 方法 jQuery 杂项方法 定义和用法 $.speed() 函数创建一个包含一组属性的对象用来定义自定义动画。 注意:1. $.speed()方法提供了一种方式来定义属性,如duration, easing, 和 queue, 用于自定义动画。 使用它,你不必自己实现默认值和可选参数所涉及的逻辑。 语法 方法一 $.speed( [duration ] [, settings ]..
jQuery jQuery.sub() 方法 jQuery 杂项方法 实例 添加一个方法到jQuery sub,以便它不会暴露在外 [mycode3 type='javascript'] (function(){ var sub = jQuery.sub(); sub.fn.myCustomMethod = function(){ return 'just for me'..
jQuery.makeArray()方法 jQuery 杂项方法 实例 将一个HTML元素集合转换成对应的数组 [mycode3 type='javascript'] $(function () { var elems = document.getElementsByTagName('div'); // 返回一个节点列表 var arr = jQuery.makeArray(ele..
jQuery.map()方法 jQuery 杂项方法 实例 使用$.map() 修改一个数组的值 [mycode3 type='JavaScript'] $(function () { var arr = [ 'a', 'b', 'c', 'd', 'e' ]; $('div'..
jQuery.merge()方法 jQuery 杂项方法 实例 合并两个数组,修改第一个参数的内容 [mycode3 type='javascript'] $(function () { var arr = $.merge( [0,1,2], [2,3,4] ); $('span').text(arr.join(', ')); }) [/mycode3] 尝试..
jQuery 杂项 noConflict() 方法 jQuery 杂项方法 实例 使用 noConflict() 方法为 jQuery 变量规定新的名称: var jq=$.noConflict(); 尝试一下 » 定义和用法 noConflict() 方法释放变量 $ 的 jQuery 控制权。 该方法也可用于为 jQuery 变量规定新的自定义名称。 提示:在其他 JavaScript 库为..
jQuery.noop()方法 jQuery 杂项方法 实例 传入一个空函数作为参数,返回一个空数组 [mycode3 type='javascript'] $(function () { var result = $.map( [1, 2, 3], $.noop ); document.writeln( result.length ); // 0 }) [/mycode3] 尝试一下 » ..
jQuery.now()方法 jQuery 杂项方法 实例 返回当前时间的Unix时间戳 [mycode3 type='javascript'] $(function () { document.body.innerHTML = $.now(); }) [/mycode3] 尝试一下 » 定义和用法 $.now() 函数用于返回当前时间距1970年1月1日午夜所经过的毫秒数。 注意:此方法..
jQuery 杂项 param() 方法 jQuery 杂项方法 实例 输出序列化对象的结果: $('button').click(function(){ $('div').text($.param(personObj)); }); 尝试一下 » 定义和用法 param() 方法创建数组或对象的序列化表示形式。 序列化的值可在生成 AJAX 请求时用..
jQuery.parseHTML()方法 jQuery 杂项方法 实例 使用一个HTML字符串创建一个数组的Dom节点,并将它插入一个div [mycode3 type='javascript'] Content: $(function () { var $log = $( '#log' ), str = 'hello, my name is jQuery.&#..
jQuery.parseJSON()方法 jQuery 杂项方法 实例 解析一个 JSON 字符串 [mycode3 type='javascript'] $(function () { var obj = jQuery.parseJSON('{'name':'John'}'); alert( obj.name === 'John&..
jQuery.parseXML()方法 jQuery 杂项方法 实例 创建一个jQuery对象使用一个XML字符串并得到标题节点的值。 [mycode3 type='javascript'] $(function () { var xml = 'RSS Title', xmlDoc = $.parseXML( xml ), $xml = $( xmlDoc ), $..
jQuery .promise() 方法 jQuery 杂项方法 实例 在一个没有激活动画的集合上调用 .promise() [mycode3 type='javascript'] $(function () { var div = $( '' ); div.promise().done(function( arg1 ) { //弹出 'true' ale..
jQuery pushStack()方法 jQuery 杂项方法 实例 向 jQuery 栈中先压入一些元素,然后再删除它们,之后再退回到之前刚压入栈的状态。 [mycode3 type='javascript'] $(function () { $().pushStack( document.getElementsByTagName('div')).remove().end()..
jQuery 杂项 removeData() 方法 jQuery 杂项方法 实例 从 <div> 元素中移除之前附加的数据: $('#btn2').click(function(){ $('div').removeData('greeting'); alert('Greeting is: ' + ..
jQuery 杂项 size() 方法 jQuery 杂项方法 实例 输出被 jQuery 选择器匹配的元素的数量: [mycode3 type='js'] $('button').click(function(){ alert($('li').size()); }); [/mycode3] 尝试一下 » 定义和用法 size() 方法在 jQue..
jQuery 杂项 toArray() 方法 jQuery 杂项方法 实例 把 <li> 元素转换为数组,然后输出该数组元素的 innerHTML : $('button').click(function(){ x=$('li').toArray() for (i=0;i<x.length;i++) { a..
jQuery.trim()方法 jQuery 杂项方法 实例 删除字符串开始和末尾的空格 [mycode3 type='javascript'] $(function () { var str = ' lots of spaces before and after '; $( '#original' ).html( 'O..