You can't. There is no way to select a range of elements in that way -- at least not with a single selector. You'll either need to specify multiple selectors for each individual element, or re-arrange the HTML to suit your selection needs.
I always prefer the latter. Structure the HTML intelligently, and the selectors become easy.
Thanks for the quick response.
This HTML is generated by a third party . Probably I need to group the tags together (using javastring manipulation or something). I was hoping that this could be achieved using some combination of selectors.
Srikkanth Mohanasundaram wrote:I was hoping that this could be achieved using some combination of selectors.
It can. That was one of the approaches I said could work.
Joined: Feb 07, 2007
Let us say i group the tags following the title paragraph (p with class name title), like this
Now, how should i form a selector to fetch the div followed by the title paragraph ? I guess something like this
$(".title + div"), but i also need to check the innerText of the title paragraph (I would want to select Title 1,Title 2 so on..).