2013-08-20 43 views
1

我有這樣的代碼:JQuery的對話框按鈕的CSS

$("#confirm").dialog({ 
       modal: true, 
       title: 'Confirm', 
       resizable: false, 
       draggable: false, 
       autoOpen: false, 
       height: 200, 
       width: 550, 
       buttons: [{ 
        tabIndex: -1, 

        text: 'Yes', 
        "class": 'informationLearnButton',   
        click: function() { 
         ... 
         } 
         else { 

         } 
         $(this).dialog("close"); 
        } 
       }, 
        { 

         tabIndex: -1, 
         text: 'No', 
         'className': 'SomeOtherCssClass', 
        click: function() { 
         $(this).dialog("close"); 
        } 
       }] 
      }); 

類不爲我工作,我試圖用類,類名有「」,沒有「」。 JQuery版本是1.8.22。 什麼現在要做的

+1

/cyBHq/1/ –

+0

看到這篇文章: - http://stackoverflow.com/questions/1828010/apply-css-to-jquery-dialog-buttons – Pranav

回答

1

這是給你一個樣本如何使用類:使用''class'`似乎罰款http://jsfiddle.net/arunpjohny

DEMO

$("#dialog").dialog({ 
    buttons: { 
     'Confirm': function() { 
      //do something 
      $(this).dialog('close'); 
     }, 
     'Cancel': function() { 
      $(this).dialog('close'); 
     } 
    }, 
    create:function() { 
     $(this).closest(".ui-dialog").find(".ui-button:first").addClass("custom"); 
    } 
});