Search code examples
jquery-uiiconsjquery-ui-button

Can I set a Custom Icon for a jQueryUI Button


Is it possible to create a jQueryUI Button with a custom icon, ie: an icon that is not part of the sprite icons that are provided with jQueryUI???

I am using the ButtonSet functionality for a group of 3 checkboxes but need a more stylised icon than what is provided out of the box...


Solution

  • Worked it out with a CSS hack.

    Setup the button as per normal and give the primary icon the "Error" class defined below

    .Error
    {
        background-image: url('Images/Icons/16/Error.png') !important;
    }
    

    The !important overrides the ui-icon definition for background-image.