user2160570
user2160570

Reputation: 11

How do I style a added button in JQuery-Ui

Below is my JQuery-UI dialog called dlgPassage.

Here is how I use it. As you can see I have added a Confirm button.

Now to my questions.

  1. How do I style this Confirm button.

  2. How do I style the area where the Confirm button in located.

JS

    $("#dlgPassage").dialog({
        width: 490,
        buttons: { "Confirm": function () { Click_btnConfirm() } } 
    });

HTML

    <div id="dlgPassage" title="Passage" style="display:none">
       <table>
          <tr><td>Opening</td></tr>
          <tr>
         <td>
            <input type="text" id="openStart" size="19"/>
            <img src="images/cal.gif" alt="" 
              onclick="javascript:NewCssCal('openStart','yyyyMMdd','arrow',true,'24')" 
              style="cursor:pointer"/> 
         </td>

         <td>&nbsp;</td>

         <td>
            <input type="text" id="openEnd" size="19"/>
            <img src="images/cal.gif" alt="" 
               onclick="javascript:NewCssCal('openEnd','yyyyMMdd','arrow',true,'24')" 
               style="cursor:pointer"/>
         </td>  
      </tr>
      <tr><td>&nbsp;</td></tr>
      <tr><td>Passage</td></tr>
      <tr>
         <td>
            <input type="text" id="passageStart" size="19"/>
            <img src="images/cal.gif" alt=""  

           onclick="javascript:NewCssCal('passageStart','yyyyMMdd','arrow',true,'24')" 
            style="cursor:pointer"/> 
         </td>
         <td>&nbsp</td>
         <td>
           <input type="text" id="passageEnd" size="19"/>
           <img src="images/cal.gif" alt="" 
            onclick="javascript:NewCssCal('passageEnd','yyyyMMdd','arrow',true,'24')" 
            style="cursor:pointer"/>
         </td>
      </tr>

      <tr><td>&nbsp;</td></tr>
      <tr><td>Closing</td></tr>
      <tr>
        <td>
           <input type="text" id="closeStart" size="19"/>
           <img src="images/cal.gif"  alt="" 
           onclick="javascript:NewCssCal('closeStart','yyyyMMdd','arrow',true,'24')" 
            style="cursor:pointer"/> 
        </td>
        <td>&nbsp</td>
        <td>
           <input type="text" id="closeEnd" size="19"/>
           <img src="images/cal.gif" alt="" 
           onclick="javascript:NewCssCal('closeEnd','yyyyMMdd','arrow',true,'24')" 
           style="cursor:pointer"/>
        </td>          
      </tr>
   </table>
</div>

Upvotes: 1

Views: 245

Answers (2)

davioooh
davioooh

Reputation: 24706

1.You can specify a class for your button:

buttons: {
    Confirm: {
        text: "Confirm"
        class: "confirm-button-style",
        click: function () { Click_btnConfirm() }   
    }
}

2.Take a look at dialog documentation, in particular at dialogClass option.


UPDATE

An example: http://jsfiddle.net/tzRHG/2/

Upvotes: 1

yeyene
yeyene

Reputation: 7380

You can update button style using create: function(), like that,

DEMO http://jsfiddle.net/yeyene/RCHA7/

$("#dlgPassage").dialog({
    create: function (event, ui) {
        $('.ui-button').css({
            'border':'1px solid #000',
            'background':'#f00',
            'font-weight':'normal',
            'color':'#fff'
        });                    
    },
    width: 490,
    buttons: { "Confirm": function () { Click_btnConfirm() } } 
});

Upvotes: 1

Related Questions