2

We have a couple <button> elements which we style with JQuery UI like this: $("#my-button" ).button();. Is there a way to have JQuery UI automatically style the buttons without explicity writing that code?

2 Answers 2

1

Presumably if your problem is having to duplicate code for each button then you could give them all a class and use $('.stylemeplease').button() or if its all buttons $('button').button().

It may be that there is a way to do it magically for anything that's a button or that there might be built in magic classes but if so I don't know of them offhand...

Sign up to request clarification or add additional context in comments.

Comments

0

Yes you can. All you have to do is all the class to the button.

You just need to add this class:

class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"

<button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">Cool Button</button>

Of course you will need to add your own padding in there.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.