Skip to main content
deleted 1 character in body
Source Link
John Slegers
  • 46.5k
  • 22
  • 202
  • 170

The problem you're having, is that you are using a Group Selector, whereas you should be using a Multiples selector! To be more specific, you're using $('.a, .b') whereas you should be using $('.a.b').

For more information, see the overview of the different ways to combine selectors here belowherebelow!


##Group Selector : ","

Select all <h1> elements AND all <p> elements AND all <a> elements :

$('h1, p, a')

##Multiples selector : "" (no character)

Select all <input> elements of type text, with classes code and red :

$('input[type="text"].code.red')

##Descendant Selector : " " (space)

Select all <i> elements inside <p> elements:

$('p i')

##Child Selector : ">"

Select all <ul> elements that are immediate children of a <li> element:

$('li > ul')

##Adjacent Sibling Selector : "+"

Select all <a> elements that are placed immediately after <h2> elements:

$('h2 + a')

##General Sibling Selector : "~"

Select all <span> elements that are siblings of <div> elements:

$('div ~ span')

The problem you're having, is that you are using a Group Selector, whereas you should be using a Multiples selector! To be more specific, you're using $('.a, .b') whereas you should be using $('.a.b').

For more information, see the overview of the different ways to combine selectors here below!


##Group Selector : ","

Select all <h1> elements AND all <p> elements AND all <a> elements :

$('h1, p, a')

##Multiples selector : "" (no character)

Select all <input> elements of type text, with classes code and red :

$('input[type="text"].code.red')

##Descendant Selector : " " (space)

Select all <i> elements inside <p> elements:

$('p i')

##Child Selector : ">"

Select all <ul> elements that are immediate children of a <li> element:

$('li > ul')

##Adjacent Sibling Selector : "+"

Select all <a> elements that are placed immediately after <h2> elements:

$('h2 + a')

##General Sibling Selector : "~"

Select all <span> elements that are siblings of <div> elements:

$('div ~ span')

The problem you're having, is that you are using a Group Selector, whereas you should be using a Multiples selector! To be more specific, you're using $('.a, .b') whereas you should be using $('.a.b').

For more information, see the overview of the different ways to combine selectors herebelow!


##Group Selector : ","

Select all <h1> elements AND all <p> elements AND all <a> elements :

$('h1, p, a')

##Multiples selector : "" (no character)

Select all <input> elements of type text, with classes code and red :

$('input[type="text"].code.red')

##Descendant Selector : " " (space)

Select all <i> elements inside <p> elements:

$('p i')

##Child Selector : ">"

Select all <ul> elements that are immediate children of a <li> element:

$('li > ul')

##Adjacent Sibling Selector : "+"

Select all <a> elements that are placed immediately after <h2> elements:

$('h2 + a')

##General Sibling Selector : "~"

Select all <span> elements that are siblings of <div> elements:

$('div ~ span')
typo, original post had div there when it should have read h1 to make the line above it make sense
Source Link

The problem you're having, is that you are using a Group Selector, whereas you should be using a Multiples selector! To be more specific, you're using $('.a, .b') whereas you should be using $('.a.b').

For more information, see the overview of the different ways to combine selectors herebelowhere below!


##Group Selector : ","

Select all <h1> elements AND all <p> elements AND all <a> elements :

$('div'h1, p, a')

##Multiples selector : "" (no character)

Select all <input> elements of type text, with classes code and red :

$('input[type="text"].code.red')

##Descendant Selector : " " (space)

Select all <i> elements inside <p> elements:

$('p i')

##Child Selector : ">"

Select all <ul> elements that are immediate children of a <li> element:

$('li > ul')

##Adjacent Sibling Selector : "+"

Select all <a> elements that are placed immediately after <h2> elements:

$('h2 + a')

##General Sibling Selector : "~"

Select all <span> elements that are siblings of <div> elements:

$('div ~ span')

The problem you're having, is that you are using a Group Selector, whereas you should be using a Multiples selector! To be more specific, you're using $('.a, .b') whereas you should be using $('.a.b').

For more information, see the overview of the different ways to combine selectors herebelow!


##Group Selector : ","

Select all <h1> elements AND all <p> elements AND all <a> elements :

$('div, p, a')

##Multiples selector : "" (no character)

Select all <input> elements of type text, with classes code and red :

$('input[type="text"].code.red')

##Descendant Selector : " " (space)

Select all <i> elements inside <p> elements:

$('p i')

##Child Selector : ">"

Select all <ul> elements that are immediate children of a <li> element:

$('li > ul')

##Adjacent Sibling Selector : "+"

Select all <a> elements that are placed immediately after <h2> elements:

$('h2 + a')

##General Sibling Selector : "~"

Select all <span> elements that are siblings of <div> elements:

$('div ~ span')

The problem you're having, is that you are using a Group Selector, whereas you should be using a Multiples selector! To be more specific, you're using $('.a, .b') whereas you should be using $('.a.b').

For more information, see the overview of the different ways to combine selectors here below!


##Group Selector : ","

Select all <h1> elements AND all <p> elements AND all <a> elements :

$('h1, p, a')

##Multiples selector : "" (no character)

Select all <input> elements of type text, with classes code and red :

$('input[type="text"].code.red')

##Descendant Selector : " " (space)

Select all <i> elements inside <p> elements:

$('p i')

##Child Selector : ">"

Select all <ul> elements that are immediate children of a <li> element:

$('li > ul')

##Adjacent Sibling Selector : "+"

Select all <a> elements that are placed immediately after <h2> elements:

$('h2 + a')

##General Sibling Selector : "~"

Select all <span> elements that are siblings of <div> elements:

$('div ~ span')
added 58 characters in body
Source Link
Hugolpz
  • 18k
  • 28
  • 102
  • 191

The problem you're having, is that you are using a Group Selector, whereas you should be using a Multiples selector! To be more specific, you're using $('.a, .b') whereas you should be using $('.a.b').

For more information, see the overview of the different ways to combine selectors herebelow!


##Group Selector : ","

Select all <h1> elements AND all <p> elements AND all <a> elements :

$('div, p, a')

##Multiples selector : "" (no character)

Select all <input> elements of type text, with classes code and red :

$('input[type="text"].code.red')

##Descendant Selector : " " (space)

Select all <i> elements inside <p> elements:

$('p i')

##Child Selector : ">"

Select all <ul> elements that are immediate children of a <li> element:

$('li > ul')

##Adjacent Sibling Selector : "+"

Select all <a> elements that are placed immediately after <h2> elements:

$('h2 + a')

##General Sibling Selector : "~"

Select all <span> elements that are siblings of <div> elements:

$('div ~ span')

The problem you're having, is that you are using a Group Selector, whereas you should be using a Multiples selector! To be more specific, you're using $('.a, .b') whereas you should be using $('.a.b').

For more information, see the overview of the different ways to combine selectors herebelow!


##Group Selector

Select all <h1> elements AND all <p> elements AND all <a> elements :

$('div, p, a')

##Multiples selector

Select all <input> elements of type text, with classes code and red :

$('input[type="text"].code.red')

##Descendant Selector

Select all <i> elements inside <p> elements:

$('p i')

##Child Selector

Select all <ul> elements that are immediate children of a <li> element:

$('li > ul')

##Adjacent Sibling Selector

Select all <a> elements that are placed immediately after <h2> elements:

$('h2 + a')

##General Sibling Selector

Select all <span> elements that are siblings of <div> elements:

$('div ~ span')

The problem you're having, is that you are using a Group Selector, whereas you should be using a Multiples selector! To be more specific, you're using $('.a, .b') whereas you should be using $('.a.b').

For more information, see the overview of the different ways to combine selectors herebelow!


##Group Selector : ","

Select all <h1> elements AND all <p> elements AND all <a> elements :

$('div, p, a')

##Multiples selector : "" (no character)

Select all <input> elements of type text, with classes code and red :

$('input[type="text"].code.red')

##Descendant Selector : " " (space)

Select all <i> elements inside <p> elements:

$('p i')

##Child Selector : ">"

Select all <ul> elements that are immediate children of a <li> element:

$('li > ul')

##Adjacent Sibling Selector : "+"

Select all <a> elements that are placed immediately after <h2> elements:

$('h2 + a')

##General Sibling Selector : "~"

Select all <span> elements that are siblings of <div> elements:

$('div ~ span')
Source Link
John Slegers
  • 46.5k
  • 22
  • 202
  • 170
Loading