Last Updated: February 25, 2016
·
16.98K
· napotopia

Adding Custom Classes to a jQuery Dialog Button

If you need to add a custom class to a button in a jQuery dialog there's a property class</code> that you can specify to get your custom classes:

$('#customDialog').dialog(
    {title   : 'Custom Dialog Title', 
     buttons : [{text  : 'Cancel', 
                 click : function() {
                             $(this).dialog('close')
                         }, 
                 class : 'custom-class'
               }]
    }
);

<div id="customDialog">Some content</div>