Tutorialsteacher

Follow Us

Articles
  • C#
  • C# OOP
  • ASP.NET Core
  • ASP.NET MVC
  • LINQ
  • Inversion of Control (IoC)
  • Web API
  • JavaScript
  • TypeScript
  • jQuery
  • Angular 11
  • Node.js
  • D3.js
  • Sass
  • Python
  • Go lang
  • HTTPS (SSL)
  • Regex
  • SQL
  • SQL Server
  • PostgreSQL
  • MongoDB
  • jQuery - Get Started
  • What is jQuery
  • jQuery - Environment Setup
  • Start using jQuery
  • jQuery - Selectors
  • jQuery - Methods
  • DOM Manipulation
  • Attributes Manipulation
  • Dimensions Manipulation
  • Traversing Elements
  • CSS Manipulation
  • Animation
  • Events
  • AJAX Introduction
  • AJAX Methods
  • Get Method
  • Post Method
  • Load Method
  • Selector Reference
  • DOM Manipulation Methods
  • Traversing Methods
  • Effects Methods
Entity Framework Extensions - Boost EF Core 9
  Bulk Insert
  Bulk Delete
  Bulk Update
  Bulk Merge

jQuery: Selector Reference

Selector PatternExampleDescription
Element$('div')Selects all <div> elements
:first$('div:first')Selects first <div> element in a DOM hierarchy.
:last$('div:last')Selects last <div> element in a DOM hierarchy.
Multiple elements$('p, div, code')Selects <p>,<div> and <code> elements
parent descendant$('div p')Selects all <p> elements which is descendant of <div>
parent child$('div > p')Selects <p> element which is child of <div>
*$(*)Selects all elements
#Id$("#myDiv")Selects element whose id is myDiv
element#id$("div#myDiv")Selects <div> element whose Id is myDiv
Multiple Ids$("#myDiv1, #myDiv2")Selects multiple elements whose id is myDiv1 or myDiv2.
.class$(".myCSSClass")Selects all the elements with className=myCSSClass.
.class .class$(".myCSSClass1, .myCSSClass2 ")Finds all elements whose class attribute is set to myCSSClass1 or myCSSClass2
element.class$("div.myCSSClass")Finds all <div> elements with className=myCSSClass
:first-child$("p:first-child")Selects all <p> elements which is the first child of its parent element. (parent element can be anything)
:last-child$("p:last-child")Selects all <p> elements which is the last child of its parent element. (parent element can be anything)
:nth-child(n)$("p:nth-child(5)")Selects all <p> elements which is the 5th child of its parent element. (parent element can be anything)
:nth-last-child(n)$("p:nth-last-child(2)")Selects all <p> elements which is the 2nd last child of its parent element. (parent element can be anything)
:only-child$("p:only-child")Selects all <p> elements which is the only child of its parent element. (parent element can be anything)
[attribute]$('[class]')Selects all the elements with the class attribute(whatever the value).
[element[attribute]$("div[class]")Selects all the <div> elements that have a class attribute(whatever the value).
element[attribute = value]$("div[className='myCls']")Selects all the <div> elements whose class attributes are equal to myCls.
element[attribute |= value]$("div[class|= 'myCls']")Selects all the <div> elements whose class attributes are either equal to myCls or starting with myCls string followed by a hyphen (-).
element[attribute *= "value"]$("div[class *= 'myCls']")Selects <div> elements whose class attributes contains myCls.
element[attribute ~= "value"]$("div[class ~= 'myCls']")Selects div elements whose class attributes contains myCls, delimited by spaces.
element[attribute $= "value"]$("div[class $= 'myCls']")Selects <div> elements whose class attribute value ends with myCls. The comparison is case sensitive.
element[attribute != "value"]$("div[class != 'myCls']")Selects <div> elements which do not have class attribute or value does not equal to myCls.
element[attribute ^= "value"]$("div[class ^= 'myCls']")Selects <div> elements whose class attribute value starts with myCls.
:contains("value")$("div:contains('tutorialsteacher')"Selects all <div> elements that contains the text 'tutorialsteacher'
:input$(":input")Selects all input elements.
:button$(":button")Selects all input elements where type="button".
:radio$(":radio")Selects all input types where type="radio"
:text$(":text")Selects all input elements where type="text" .
":checkbox"$(":checkbox")Selects all checkbox elements.
:submit$(":submit")Selects all input elements where type="submit".
:password$(":password")Selects all input elements where type="password".
:reset$(":reset")Selects all input elements where type="reset".
:image$(':image')Selects all input elements where type="image".
:file$(':file')Selects all input elements where type="file".
:enabled$(':enabled')Selects all enabled input elements.
:disabled$(':disabled')Selects all disabled input elements.
:selected$(':selected')Selects all selected input elements.
:checked$(':checked')Selects all checked input elements.
:hidden$(':hidden')Selects all hidden elements.
:visible$(':visible')Selects all visible elements.
:odd$('tr:odd')Selects all odd rows. (1,3,5,7..)
:even$('tr:even')Selects all even rows.(0,2,4,6..)
TUTORIALSTEACHER.COM

TutorialsTeacher.com is your authoritative source for comprehensive technologies tutorials, tailored to guide you through mastering various web and other technologies through a step-by-step approach.

Our content helps you to learn technologies easily and quickly for learners of all levels. By accessing this platform, you acknowledge that you have reviewed and consented to abide by our Terms of Use and Privacy Policy, designed to safeguard your experience and privacy rights.

[email protected]

ABOUT USTERMS OF USEPRIVACY POLICY
copywrite-symbol

2024 TutorialsTeacher.com. (v 1.2) All Rights Reserved.