I took this approach for one of my buttons and I discovered some interesting things:
- I didn t need to use the "!important" override
- I needed to set background-position for my button (otherwise I think the background was being displayed well outside the button)
- It looks like you can also put anything you like in the jQueryUI primary icon name - it just needs something as a placeholder.
For my uses I ended up with:
Javascript:
jQuery(function() {
jQuery( #share-button ).button({
icons: { primary: "icons/share" }
});
});
CSS:
#share-button > span.ui-icon {
background-image: url(icons/share.png);
background-position:0px 3px;}
HTML:
<button id= share-button >Share</button>