Jump to content

Hide a div if field is checked!


Roych
 Share

Recommended Posts

Hello,

Im having some trouble hiding a <p> in my template if a checkbox is "checked".
I have two fields "text field for a button" and "simple checkbox for hidding a text button field" with a dependency to hide button field if hecked.

Now I need to hide that button in frontend if checked. 

It is a list of pages "blog like" with a read more button. Sometimes that button is not nessasary so I need an option to hide it on some articles.

I tried with: (RemoveButton = Checkbox field  -  Text = Button text field)

<?php if (strlen(trim($single->RemoveButton)) > 1): ?>
<p><a button  href="<?= $single->url ?>" type="submit" id="submit" class="btn btn-blue btn-effect"><?=$single->Text?></button></a></p>
<?php endif; ?>

I need to hide all that <p> somehow.

Hope I wrote understandable.

R

Link to comment
Share on other sites

If RemoveButton is not false then show the button:

<?php if (!$single->RemoveButton) : ?>
	<p><a button href="<?= $single->url ?>" type="submit" id="submit" class="btn btn-blue btn-effect"><?=$single->Text?></button></a></p>
<?php endif; ?>
  • Like 4
Link to comment
Share on other sites

5 minutes ago, arjen said:

If RemoveButton is not false then show the button:


<?php if (!$single->RemoveButton) : ?>
	<p><a button href="<?= $single->url ?>" type="submit" id="submit" class="btn btn-blue btn-effect"><?=$single->Text?></button></a></p>
<?php endif; ?>

Woow, that was fast and works perfect. Very helpfull also,

thank you ;)    

R

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...