views:

17

answers:

2

I was wondering - is it possible to apply the jQuery UI CSS to an entire site without having to apply it individually upon elements?

So, for example, instead of having to do:

<input type="button" value="Submit" class="ui-state-default ui-corner-all" />

to all my buttons, I instead have some sort of class applied at at top-level DIV which will change the entire site whenever it can be (any element that jQuery UI can handle). If it's not possible, it's no big deal, but it would be great if it is.

A: 

I suppose you could apply it on the $(document).ready(function(){$("*").addClass("ui-state-default")});

This is not tested, so don't take my word for it.

Regards, Byron Cobb

Byron Cobb
+1  A: 

Yes. You can just call

$('button').button()

from your script to select all button elements using jQuery and apply the jQuery UI button theming to them. See, for example, the sample code on the jQuery UI button demo.

Brian Campbell
Ah...cool. Of course, my site has to load some stuff all "AJAX-y" so it doesn't apply to those buttons. Any suggestions. (Either way, I'm marking this answer as correct.)
JasCav
BTW, you meant ':button' as your selector, right? (I'm assuming so.)
JasCav