What is a good way to make a conditional button?


#1

I’d like to use jQuery-UI styling. I can declare buttons in Blaze onRendered() just fine if they always exist in a template. But what about a button that only shows up conditionally? I can’t declare it a $('#id').button() in onRendered() if the button is inside an {{#if}} block. I could use a helper function to essentially write {{#if helper}}style='display:none;'{{/if}} but … that feels bad. I don’t really like the idea of a sub template that has one element (the button) just to have an onRendered() function to call button() in either. I’m not seeing an applicable event type in the Meteor Templates API. This has to be a relatively common use case, so what is a good/preferred way to solve it?