Check text with contains in iFrame

Check text with contains in iFrame

Hi

Just whant to get this conditional works. The HMTL-Codes looks like this:

  1. <div id="availableLanguagesContainerBody">
  2. <a onclick="changeUserLanguage('EN')" href="#"> English </a>
  3. </div>

With JS and JQ I whant to check if the User choosed "English" or other languages.

  1. if ($('iframe').contents().find("#availableLanguagesContainerBody a:contains('English')")) {
  2. //do JS//;
  3. }

Javascript allways says that this text/object exist, even there is something else.

Do you have an idea?

Thank you for your reply.