Cyclone
Cyclone

Reputation: 15269

Getting the closest item with specified ID after tr

I'm using this:

$(this).closest('tr').next()

To select a table row, but I also need to select a tr with specified id after this tr.

I've tried like to do it this way:

var a = $(this).closest('tr').next()
var b = $(a).closest('#itemrow').next()

var a is working fine, but it does not select an var b.

What it the problem?

Upvotes: 0

Views: 496

Answers (2)

Sedat Başar
Sedat Başar

Reputation: 3798

I guess if u do this it will work fine

var a = $(this).closest('tr').next()
var b = a.closest('#itemrow').next()

a is already a jquery object dont surround it with $()

Upvotes: 1

IUnknown
IUnknown

Reputation: 22468

var a = $(this).closest('tr').nextAll('#itemrow:first')

Upvotes: 1

Related Questions