Jquery-selectors-lastchild Select the last child element

Source: Internet
Author: User
Jquery-selectors-lastchild Select the last child element Selectors/lastchild From jQuery JavaScript Library : Last-child OverviewMatches all elements this are the last child of their parent. While:last matches only a single element, this matches the more then one:one for each parent.Demo

Finds the last span in each matched div and adds some CSS plus a hover state.

    $ ("div span:last-child")
. css ({color: "Red", FontSize: "80%"})
. Hover (function () {
$ (this). addclass ("Solast");
}, function () {
$ (this). Removeclass ("Solast");
});
View Source
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en"
"Http://www.w3.org/TR/html4/loose.dtd" >
<script src= "Http://code.jquery.com/jquery-latest.js" ></script>

<script>
$ (document). Ready (function () {

$ ("div span:last-child")
. css ({color: "Red", FontSize: "80%"})
. Hover (function () {
$ (this). addclass ("Solast");
}, function () {
$ (this). Removeclass ("Solast");
});

});
</script>
<style>
span.solast {Text-decoration:line-through;}
</style>
<body>
<div>
<span>John,</span>
<span>Karl,</span>
<span>Brandon,</span>
<span>Sam</span>
</div>
<div>
<span>Glen,</span>
<span>Tane,</span>
<span>Ralph,</span>
<span>David</span>
</div>
</body>
[Jquery-selectors-lastchild Select Last child element-document]


[jQuery-official website]http://jquery.com/[JQUERY-DOWNLOAD DOWNLOAD]Current version, http://docs.jquery.com/Release:jQuery_1.3.1
Download list, Http://docs.jquery.com/Downloading_jQuery
Latest code, Http://code.jquery.com/nightlies/jquery-nightly.js
[jQuery-related forum]Http://groups.google.com/group/jquery-en
http://WebDev.board.newsmth.net/
http://WebGeeks.board.newsmth.net/
http://bbs.pku.edu.cn/, homepage look at the version
http://forum.csdn.net/SList/JavaScript/
[jQuery-keywords]Jquery
[jQuery-documents]Http://docs.jquery.com/Main_Page
[Jquery-core Core]Each iteration, Http://docs.jquery.com/Core/each
JQuery, Http://docs.jquery.com/Core/jQuery
[Jquery-ajax]jquery's Ajax documentation, Http://docs.jquery.com/Ajax/jQuery.ajax
jquery Ajax options, http://docs.jquery.com/Ajax/jQuery.ajax#options
DataType options, setting the return value type
Timeout option, for setting timeouts
Integration with PHP can use Json_encode to return results, http://www.php.net/manual/zh/function.json-encode.php

ReadyState get the current status of the request operation, http://msdn2.microsoft.com/en-us/library/ms534361.aspx [jQuery-effects]

jquery fade effect, http://docs.jquery.com/Effects/fadeIn [jquery-selectors selector] form element selector, http://docs.jquery.com/ Dom/traversing/selectors#form_selectors
Attribute Equality Selector, http://docs.jquery.com/Selectors/attributeEquals
Checked selected, http://docs.jquery.com/Selectors/checked

: Input matches all input, textarea, select, and button elements, and the http://docs.jquery.com/Selectors/input selector selects the title tag that appears in the body. will appear and expect a different effect.

element matches all elements by the specified name, http://docs.jquery.com/Selectors/element

LastChild Select the last child element, Http://docs.jquery.com/Selectors/lastChild

[Jquery-attributes Property]

Val gets the contents of the first matching element value property, Http://docs.jquery.com/Attributes/val [jquery-common functions] attr access to custom attributes, Reduce the coupling of code and data in JavaScript scripting
filter, for filtering elements in the collection
[jquery-events event] hover, http://docs.jquery.com/Events/hover
Submit Submission, Http://docs.jquery.com/Events/submit

Focus responds to focal events for each matching element, Http://docs.jquery.com/Events/focus

Click to trigger the click event for each matching element, the binding function to the Click event for each matching element, Http://docs.jquery.com/Events/click [jquery-manipulation Action]

After inserting the content after each matching element, Http://docs.jquery.com/Manipulation/after [jquery-traversing Walker] filter, http:// Docs.jquery.com/traversing/filter
Find Lookup, Http://docs.jquery.com/Traversing/find
[jquery-tutorials Tutorial] Introducing $ (document). Ready (), Http://docs.jquery.com/Tutorials:Introducing_%24%28document%29.ready%28%29 [ Jquery-plugins plugin] easing animation, http://jquery.com/plugins/project/easing
Jcarouselite, merry-go effect, Http://jquery.com/plugins/project/jCarouselLite
Tablefilter, table filter, Http://jquery.com/plugins/project/tableFilter
Rounded corner Rounded Rectangle, http://docs.jquery.com/Tutorials:Rounded_Corners#Rounded_Corners_Without_Images

Jeditable Original Location Editor plugin, http://plugins.jquery.com/project/jeditable

Cookies, Http://plugins.jquery.com/project/Cookie [jquery-utilities utility] trim removes the spaces before and after the string, http:// Docs.jquery.com/utilities/jquery.trim [Jquery-ui] UI, Http://docs.jquery.com/UI
ui/theming, http://docs.jquery.com/UI/Theming [jquery-reference] http://www.json.org/, http://www.json.org/json.js

JScript (Windows Script Technologies):, http://msdn2.microsoft.com/en-us/library/hbxc2t98.aspx

Prototype property (JScript 5.6):, http://msdn2.microsoft.com/en-us/library/f5s9ycex.aspx

parseint Method (JScript 5.6):, http://msdn2.microsoft.com/en-us/library/x53yedee.aspx

ToString method (JScript 5.6):, http://msdn2.microsoft.com/en-us/library/k6xhc6yc.aspx

HTTP Status codes (Windows):, http://msdn2.microsoft.com/en-us/library/Aa384325.aspx

Html+time: http://msdn2.microsoft.com/en-us/library/ms533112.aspx

Hta:application object, http://msdn2.microsoft.com/en-us/library/ms536495.aspx

About Cross-frame Scripting and security: about cross-framework scripting and safety, http://msdn2.microsoft.com/en-us/library/ms533028.aspx

How to builds tables dynamically: How dynamically build Tables, http://msdn2.microsoft.com/en-us/library/ms532998.aspx

Filter property (Tabular Data Control):-Filter properties (Tabular database controls), http://msdn2.microsoft.com/en-us/library/ms531364.aspx

Close Method (window):, http://msdn2.microsoft.com/en-us/library/ms536367.aspx

ECMA standard Download, http://www.ecma-international.org/publications/standards/Ecma-262.htm

parseint Method (JScript 5.6):-IE Standard, http://msdn2.microsoft.com/en-us/library/x53yedee.aspx

Complete property (IMG, input, input type=image):, http://msdn2.microsoft.com/en-us/library/ms533688.aspx

FireEvent method (A, ABBR, acronym, ...):, http://msdn2.microsoft.com/en-us/library/ms536423.aspx

Sunspider JavaScript benchmark:javascript performance test, http://webkit.org/perf/sunspider-0.9/sunspider.html

onBeforeUnload Event (Body, FRAMESET, window):, http://msdn2.microsoft.com/en-us/library/ms536907.aspx

[JQuery-composite example]

Achieve the previous and the last effect

Calling functions across Windows

Timed Refresh

Drop-down list box to open a specified Web site generates random numbers between two boundaries
Text input box and label replace automatically

Password input box and label automatic replacement

Automatic change of text input area and label

Pre tags in IE and Firefox under the effect of relatively ideal line-wrapping processing fixed table header, scrolling table contents

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.