I have problem in selecting links from a web document which contains word “FooBar”.
I tried A:contains('FooBar') on selector test and it worked however it doesn’t work from my jsoup application which is based on CSS3 selectors.
selector test: http://www.w3schools.com/jquery/trysel.asp?filename=trysel_basic&jqsel=p.intro,%23choose
seems like CSS3 doesn’t support :contains http://www.w3.org/TR/2009/PR-css3-selectors-20091215/#content-selectors
any alternative to :contains in CSS3?
I believe that
:containswas removed from the CSS3 spec, and that no browsers currently support it.If you want to select an anchor element with an
hrefcontaining “FooBar”, you can use something like this:This selector works on any attribute and is supported in all major browsers, including IE7+.
See DEMO.