'Redirect if element is shown in embedded form

I need your help redirecting the page which has embedded form and if the element is shown, I want it to redirect to a certain page. Thank you!

<script>
if ( receipt number (element) is shown it will redirect below ) {
  window.location.href = "https://www.example.com";
}
</script>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source