Добавьте класс к диалоговым кнопкам jQuery

HTTP в настоящее время недогружен и неправильно используется.

Мы обычно используем только два метода HTTP: ДОБЕРИТЕСЬ и POST, но еще существуют некоторые: УДАЛИТЕ, ПОМЕСТИТЕ, и т.д. ( http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html )

Поэтому, если у нас есть ресурсы, определенный УСПОКОИТЕЛЬНЫМИ URL (каждый объект области в Вашем приложении имеет уникальный URL в форме http://yoursite.com/path/to/the/resource ), и достойная реализация HTTP, мы можем управлять объектами в Вашем домене путем записи предложений:

ДОБИРАЮТСЯ , http://yoursite.com/path/to/the/resource

УДАЛЯЕТ http://yoursite.com/path/to/the/resource

POST http://yoursite.com/path/to/the/resource

и т.д.

, архитектура хороша и все.

, но это - просто теоретическое представление, сценарии реального мира описаны во всех ссылках, отправленных в ответах перед моим.

21
задан nicosomb 24 September 2009 в 13:36
поделиться

4 ответа

У меня есть решение, благодаря Ричу:

$(document).ready(function(){
      $('#messageBox p').html('bla bla bla. Ok?'); 
      $('#messageBox').dialog({
        modal : true,
        dialogClass: 'dialogButtons',
        buttons: {
          'Yes': function() {
                doSomething();
                $(this).dialog('close');
          }, 
          'No': function() {
                doAnotherThing();
                $(this).dialog('close');
          }
        }
      });
    });
$("div.dialogButtons div button:nth-child(1)").addClass("oneCssClass");
$("div.dialogButtons div button:nth-child(2)").addClass("anotherCssClass");

Решено !

8
ответ дан 29 November 2019 в 06:32
поделиться

There's a dialogClass option of the dialog function you can use to specify a css class for the dialog itself. You can give it a unique class name and use this class name to get a reference to any child elements of the dialog. Then, use the selectors to either get a reference to the child buttons by position or by the text it contains (probably more efficient to use the former).

5
ответ дан 29 November 2019 в 06:32
поделиться

Вы пробовали функцию addClass ?

1
ответ дан 29 November 2019 в 06:32
поделиться

.addClass функция

-4
ответ дан 29 November 2019 в 06:32
поделиться
Другие вопросы по тегам:

Похожие вопросы: