0

I wish to add a class definition to an element creatured with button : { } how do I do so without doing something like $('.ui-dialog-buttonpane button:eq(0)')

http://jsfiddle.net/3zcEY/

     $(function() {
            $( "#dialog-confirm" ).dialog({
              resizable: false,
              height:140,
              modal: true,
              buttons: {
 //add a class definition to the delete all items button here. tried  
//class:'save' didn't work

                "Delete all items": function() {
                  $( this ).dialog( "close" );
                },
                Cancel: function() {
                  $( this ).dialog( "close" );
                }
              }
            });
          });

1 Answer 1

3

You can use the option object to specify the classname.

$("#dialog-confirm").dialog({
        resizable: false,
        height: 140,
        modal: true,
        buttons: {
            //add a class definition here.
            "Delete all items": {
                'class': 'customClass', //<-- specify the class here
                text: 'Delete all items', //<-- text for the button
                click: function () { //click handler
                    $(this).dialog("close");
                }
            },
            Cancel: function () {
                $(this).dialog("close");
            }
        }
    });

Fiddle

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.