0

My jquery selector ,

$($('ul *[data-date="abc"]'))

Retrieves following elements from html,

<li class="current week" data-wk="39" data-date="abc"></li>
<li class="day" data-date="abc"></li>
..
..
..
.
.
<li class="day" data-date="abc"></li>

But I dont want its first element. How to do that ?

What I have tried is ,

$($('ul *[data-date="abc"]:not(.current week)'))

But it is still returning all the results.

  • possible duplicate : http://stackoverflow.com/questions/1041344/jquery-multiple-class-selector – VPK Sep 22 '14 at 11:19

4 Answers4

1

current week are 2 different classes, so you need to use

$('ul *[data-date="abc"]:not(.current.week)')

Also there is no need to use 2 sets of $

Arun P Johny
  • 384,651
  • 66
  • 527
  • 531
0

If you want to exclude first element then try this:

$('ul *[data-date="abc"]:not(:first)')

Or if you want to exclude elements with class current week then try this :

$('ul *[data-date="abc"]:not(.current.week)')
Kartikeya Khosla
  • 18,743
  • 8
  • 43
  • 69
0

use the least selector

$("ul li.day[data-date='abc']")
Mayank
  • 1,351
  • 5
  • 23
  • 42
0
$('ul *[data-date="abc"]').find("li:gt(0)")

You can try using the gt(0) in the find selector. 0 is the first LI element. The above statement will return all the LI's except the first one.

Karan
  • 3,265
  • 9
  • 54
  • 82