I have used Jsoup to fetch a page from a URL. I can extract the link of certain id using the following line of code:
Elements links = doc.select("a[href]#title0");
How can I find the elements if I only know the part of its ID for example ‘title’. I know that I could find all the a links with the href and then iterate through the ‘links’ and check whether it’s id contains ‘title’ substring or not however I would like to avoid this approach. Is there a way to filter the links in the selector and check whether it’s id contains ‘title’ substring?
You can use something like:
this would return all the links with id starting with string “nav”
The following will return all the links with id containing string “logo”