I have a button which I style using jQuery’s UI’s button.
<button class="widget-button">Submit</button>
Based on certain events this button can have its text cleared.
$('.widget-button').button('option', 'label', '');
When this occurs the button’s height becomes smaller. I would like to maintain the button’s height even when no text is shown.
Any ideas on how this can be achieved?
This is untested but, I think, should work (and without seeing your html I can’t offer anything better):
This should, in theory, assign the current
heightas an inline-style to the.widget-buttonbefore clearing the text. You could, of course, also use adata-prefixed custom attribute:But, as noted, this is untested. If you can post your mark-up, and the jQuery code you’re working with to clear the
button‘s text we might be able to offer better answers.