jQuery Ui Dialog Buttons, How to add class?

gerky picture gerky · Jul 15, 2011 · Viewed 68k times · Source

I found this answer on another thread..

How to add multiple buttons in Jquery UI dialog box?

Using this syntax, how do you add class to a particular button?

 $("#mydialog").dialog({
      buttons: {
        'Confirm': function() {
           //do something
           $(this).dialog('close');
        },
        'Cancel': function() {
           $(this).dialog('close');
        }
      }
    });

Answer

Imran Khan picture Imran Khan · Jul 15, 2011

You Can add class to the button's in Dialog...by

$('#mydialog').dialog({
  buttons:{
    "send":{
      text:'Send',
      'class':'save'
    },
    "cancel":{
      text:'Cancel',
      'class':'cancel'
    }
  });

I think this will work for you. and you can find more answers here.