html i box

I have tried to read an HTML text. so if there is a text, a box must open, otherwise it should be closed, but it does not work. What’s wrong ?

$w.onReady( function () {
//TODO: write your page related code here…
if ( $w(“#html1”)) {
$w(“#box9”).expand();
}
else {
$w(“#box9”).collapse();
}
});

Hi,
In order to communicate with the HTML component in your site you need to use massaging, check it out here .

Good luck :slight_smile:

Hi

I’ve tried back and forth according to what you referred to, but I can not make it work.

  1. I have a script code ” ”, which shows a text if someone posts it, otherwise there will be no text.

  2. I would like to read this text and if there is no text, it should not be visible, on the other hand, it should be open to the text.

See screen.

Thanks in advance.