How to check a selector matches some content using jQuery?