0

誰かがクラスを ui-dialog-buttonset に追加するのを手伝ってくれませんか..「追加」と「削除」の 2 つのボタンがあり、それぞれを適切にスタイルしたいと考えています。

「このアイテムを追加」というボタンにクラスを追加するにはどうすればよいですか

$dialogContent.dialog({
            modal: true,
            resizable: false,
            title: "New thing",
            close: function() {
                $dialogContent.dialog("destroy");
                $dialogContent.hide();
                $('#other').stuff("removeUnsavedEvents");
            },

            buttons: {
                'Add this item' : function() {

                    if(client_url.val() == '')
                    {
                        alert('client not selected');
                        $other.stuff("removeUnsavedEvents");
                        $dialogContent.dialog("close");
                        return;
                    }

                            $dialogContent.dialog("close");
                        },
                    });

                    update_stuff_overview();
                }
            }

        }

ありがとう

ui-dialog プラグインから html を追加するように編集しました。

<div class="ui-dialog-buttonset">
    <button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button">
        <span class="ui-button-text">Add this item</span>
    </button>
</div>

上のボタンに「new_class」を追加しようとしています。

4

2 に答える 2

0

これが答えです

var button_text = $('#button-id').attr('value');
if(button_text == 'Add this item'){
    $('#button-id').addClass('class_name');
}
于 2012-04-10T05:44:02.833 に答える