1
$(document).ready(function() {
$( "#addLocation" ).dialog({
        modal: true,
        height: 820,
        width: 550,
        buttons: {
            "Add Location": function() {
                document.forms['mapform'].submitted.value='1';
                document.forms["mapform"].submit();
            },
            Cancel: function() {
                $( this ).dialog( "close" );
            }
        },
});
});

How can I implement the addClass function to the 'Add Location' button on the modal dialog?

Thanks,

3 Answers 3

2

Make buttons an array and set the button as an object

    buttons: [{
        text: "Add Location",
        click: function() {
            document.forms['mapform'].submitted.value='1';
            document.forms["mapform"].submit();
        },
        class: "myCssClass"}]
Sign up to request clarification or add additional context in comments.

Comments

0

does $(this).addClass("myCssClass")

not work?

And if not, let the browser rendering the button and add aftwardes the the css class.

1 Comment

try the option dialogClass (see jqueryui.com/demos/dialog/#option-dialogClass) and bind the css class to the html tag button. I think this is the only one option do you have.
0
$("#addLocation").dialog("widget").find(".ui-dialog-buttonset button:eq(0)").addClass("");

You just need to set the correct index for :eq()

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.