External Libraries

Jsoup select elements with multiple classes example

Jsoup select elements with multiple classes example shows how to select elements having multiple classes.

How to select elements with multiple classes using Jsoup?

Many a times HTML elements have multiple classes applied to them using “class” attribute as given below.

It becomes little tricky to select such elements using CSS style selectors. If div had single class named “left-align”, you could have written Jsoup CSS selector like given below.


If the element contains multiple classes, you can join them using separator “.” as given below.


Please note that there is no space between two classes.

Here is the full example program to select div with multiple classes.


Please let us know your views in the comments section below.

Want to learn quickly?
Try one of the many quizzes. I promise you will not be disappointed.


About the author



rahimv has over 15 years of experience in designing and developing Java applications. His areas of expertise are J2EE and eCommerce. If you like the website, follow him on Facebook, Twitter or Google Plus.

Add Comment

Your email address will not be published. Required fields are marked *