While searching the solution I found a few approaches that could be a way. The closest to me was described here: Apply CSS to jQuery Dialog Buttons. But the reason why I wouldn't like to take it is css should be corrected every time after changes. Despite it's not so bad I prefer the approach when a button is being changed to an image.
$(".my-dialog").dialog({
buttons: [{ text: "Cancel", id:"cancelId" },
{ text: "Submit", id:"submitId" }}]
create: function (event, ui) {
setButtonStyle($("#cancelId"), "url/img/button/cancel.gif",
function () { $(".my-dialog").dialog("close") });
setButtonStyle($("#submitId"), "url/img/button/submit.gif",
function () { //... });
});
function setButtonStyle(button, src, onclick) {
var elementId = button[0].id;
var attrs = {}
button.replaceWith(function () {
attrs["id"] = elementId;
attrs["src"] = src
return $("<img />", attrs).append($(this).contents());
});
var img = $("#" + elementId);
img.click(function () { if (onclick) onclick(); });
img.css("cursor", "pointer");
}