`

jQuery end()方法

阅读更多
转自:http://hyipaying.com/article/jquery/20100915/jquery-end-method.html
    对于end()方法,jQuery文档是这样解释的:jQuery回到最近的一个"破坏性"操作

之前。即,将匹配的元素列表变为前一次的状态。

    但给的例子并不是很明显,相信不少人并没有理解它的用法。

    下边我们以一个非常简单的例子来说明下用法,html代码如下:

Html代码 
<div id="test"> 
    <h1>jQuery end()方法</h1> 
    <p>讲解jQuery中end()方法。</p> 
</div> 

    下边是一小段jQuery代码:

Js代码 
$(document).ready(function() { 
    $("#test").click(function() { 
        $(this).find("p").hide().end().hide(); 
    }); 
}); 

    点击id为test的div时,首先找到div里边的p标签,将其隐藏。接下来使用end()

方法结束了对p标签的引用,此时返回的是#test(jQuery对象),从而后边的hide()方法

隐藏了div。这样相信大家已经理解了jQuery中end()方法。

分享到:
评论

相关推荐

    jQuery的end()方法使用详解

    本文给大家分享的是jQuery中的end()的定义和使用方法及示例,非常简单实用,有需要的小伙伴可以参考下。

    jQuery中end()方法用法实例

    主要介绍了jQuery中end()方法用法,实例分析了end()方法的功能、定义与回到最近的一个"破坏性"操作之前的使用技巧,需要的朋友可以参考下

    关于jQuery中的end()使用方法

    最近在学习jQuery方面的知识,学习中遇到一定的困难,一些知识不得不查看官方的文档,在用到end()方法时,被一个小例子搞得有点晕。

    jQuery.Essentials.

    By the end of this book, you will be able to to build robust and efficient websites successfully using JQuery. Table of Contents Chapter 1. jQuery Part by Part Chapter 2. jQuery Selectors and ...

    jQuery 1.4.1 中文参考

    2.1 jQuery 核心函数 17 2.1.1 jQuery(expression, [context]) 17 2.1.2 jQuery(html, [ownerDocument]) 18 2.1.3 jQuery(html, props) 19 2.1.4 jQuery(elements) 20 2.1.5 jQuery() 20 2.1.6 jQuery(callback) 21 ...

    Java Web Jquery表单验证

    1、将基于Jquery的表单验证的调查问卷分为四个部分:FrontPage.html、write.html、end.html、style.css。 1、硬件要求:计算机一台 2、软件要求:Chrome浏览器、IE11浏览器、Firefox浏览器 3、网络要求:能访问...

    Pro PHP and JQuery

    generating HTML markup on the fly, and creating modal windows., Who this book is for, This book is intended for programmers who want to bridge the gap between front- and back-end programming....

    Learning jQuery 3 - Fifth Edition

    By the end of the book, you will be able to successfully create a fully featured and efficient single page web application and leverage all the new features of jQuery 3.0 effectively. Style and ...

    [jQuery.UI.1.7.jQuery用户界面库].文字版.pdf

    By the end of the book, you'll be an expert in its implementation. We already have a basic working knowledge of the components when we add a new component because of the consistency in how we ...

    jqueryAPI_helper

    jQuery(callback) 未翻译的翻译一下 slice(start,[end]) 未翻译的翻译一下 parent(expr) 例子中删除个body append(content) C要 css(name) 删除多余的 unbind([type],[data]) 代码注释翻译 change(fn) 未...

    JQuery新版中文手册

    slice(start,[end]) 查找 children([expr]) closest(expr,[con]|obj|ele)1.6* find(expr|obj|ele)1.6* next([expr]) nextall([expr]) nextUntil([exp|ele][,fil])1.6* offsetParent() parent([expr]) ...

    jQuery 1.5 API 中文版

    $.jQuery( selector [, context] ), .jQuery( element ), .jQuery( elementArray ), .jQuery( jQueryObject ), .jQuery( ) $.jQuery( html [, ownerDocument] ), .jQuery( html, props ) $.jQuery( fn ) jQuery ...

    Applied jQuery: Develop and Design

    Jay Blanchard, has practical experience working in the field and wastes no time getting to the instruction, taking the reader from a beginner to a proficient interface programmer by the end of the ...

    jQuery详细教程

    jQuery 事件处理方法是 jQuery 中的核心函数。 事件处理程序指的是当 HTML 中发生某些事件时所调用的方法。术语由事件“触发”(或“激发”)经常会被使用。 通常会把 jQuery 代码放到 部分的事件处理方法中: 实例 ...

    jQuery 1.3 API 参考文档中文版 html

    * 修改queue和dequeue方法的参数和说明 2009-01-15 22:31:02 +0800 * jQuery(html,[ownerDocument]) + jQuery.selector + jQuery.context * 效果下的queue和dequeue搬到核心下 + live() + die() + closest() * stop...

    jquery-easyui-1.3.6.zip

    jQuery EasyUI是一组基于jQuery的UI插件集合,而jQuery EasyUI的目标就是帮助web开发者更轻松的打造出功能丰富并且美观的UI界面。开发者不需要编写复杂的javascript,也不需要对css样式有深入的了解,开发者需要了解...

    jquery msgbox

    仿QQ空间信息提示效果,成功:$.msgbox({type:'success',msg:'操作成功',end:function(){//do something}}); 失败:$.msgbox({type:'error',msg:'操作失败',end:function(){//do something}}); 提示或警告:$.msgbox...

    jQuery常用方法

    jQuery 常见操作实现方式 $("标签名") //取html元素 document.getElementsByTagName("") $("#ID") //取单个控件document.getElementById("") $("div #ID") //取某个控件中 控件 $("#ID #ID") // 通过控件ID...

Global site tag (gtag.js) - Google Analytics