If statement problem

Hi
I need a conditional statement that in normal speak means:
“If an object exists or is visible play audio on mouse clicked”
I know how to make my audio play on mouse clicked but just do not know how to write the conditional part.
Thanks!

Is this object a UI element? a datum from your collection? Something else?

It’s a text box, I will also need it for images, which are stored in my uploads

To check if visible:

if($w("#text1").isVisible){//put you code here}

to check if exists:

if(typeof $w("#text1").id !== "undefined"){//put you code here}

@jonatandor35 Thanks for helping but with the first line I am getting “passing error: unterminated string constant”
The second line is accepted but nothing happens when i run the published site.

@garyowenschofield sorry, I had a typo. fixed.