jQuery Ui Dialog Buttons, How to add class?

前端 未结 5 1440
花落未央
花落未央 2020-12-29 00:53

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?<

5条回答
  •  囚心锁ツ
    2020-12-29 01:36

    Thanks to LintonB, you can add all of the property attached to a button like style, id, etc...

    dialog_options.buttons = {
      'Modify': {
        click: function() {
    
          $(this).dialog('close');
    
          if (inputs.phone !== '') {
            inputs.phone.focus();
            inputs.phone[0].value = "";
          }
        },
        class: 'btn btn-labeled btn-warning',
        style: 'margin-right: 30px;',
        id: 'modificationId'
      },
      'Keep': {
        click: function() {
          $(this).dialog('close');
    
          _this.validatePhone(i);
    
        },
        class: 'btn btn-labeled btn-warning',
        id: 'conserverId'
      }
    };
    

提交回复
热议问题