jQuery UI Dialog Button Icons

后端 未结 12 1470
[愿得一人]
[愿得一人] 2020-11-29 02:40

Is it possible to add icons to the buttons on a jQuery UI Dialog? I\'ve tried doing it this way:

$(\"#DeleteDialog\").dialog({
    resizable: false,
    hei         


        
12条回答
  •  误落风尘
    2020-11-29 03:14

    Try this line to add the trash icon to the delete button. The sprite has to be in a separate element.

    $('.ui-dialog-buttonpane').find('button:contains("Delete")').prepend('');
    

    In order to prevent the icon from appearing on the top of the button:

    $('.ui-dialog-buttonpane')
        .find('button:contains("Delete")')
        .removeClass('ui-button-text-only')
        .addClass('ui-button-text-icon-primary')
        .prepend('');
    

提交回复
热议问题