Change the icon of a jQuery UI button with own image

Viewed 45397

Currently I have the following jQuery UI button:

$('#button').button(
  {
    label: 'Test',
    icons: {primary: 'ui-icon-circle-plus', secondary: null}
  }
);

I wish to use own image for the button called 'custom.png'.

How I can achieve that?

7 Answers

If only an image to display at the button, without label or text, I do this :

$('#button').button();

to replace this image element to become a button :

<img src="images/custom.png" width="28" height="28" id="button">

But if you prefer following with label or text, tschlarm explanation above is better.

Related