Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQueryUI dialog - button text not appearing

I have a strange error occurring with the dialog box, I'm loading the dialog box fine, but whenever I assign a button to it, although it'll display the button, it won't display the name of the button. Here is my code that launches the dialog successfully...

jQuery('#'+message_div_id).dialog({
    modal:      ui_popup_modal
,   width:      ui_popup_width
,   height:     ui_popup_height
,   resizable:  false
,   draggable:  false
,   buttons:    {
                    "Ok": function() {
                        jQuery( this ).dialog( "close" );
                    }
                }
});

This is the resulting html from bugzilla after the popup has loaded...

< button type="button" text="Ok" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">< span class="ui-button-text">< /span>< /button>

The span class is the area that should contain the text, but as you can see, it is not. Any ideas?

like image 694
Vin Avatar asked Feb 17 '11 15:02

Vin


2 Answers

This inspired me a lot, but it didn't work exactly for me, I made the following modifications. I think this works better.

$('div.ui-dialog-buttonset button.ui-button span.ui-button-text').each(function() {
    $(this).html($(this).parent().attr('text'));
});
like image 102
conceptacid Avatar answered Nov 06 '22 02:11

conceptacid


This works for me with jQuery UI v1.8.22 CDN (tested):

$('div.ui-dialog button.ui-button').each(function() {
   $(this).children('.ui-button-text').html($(this).attr('text'));
});
like image 23
Martin Zeitler Avatar answered Nov 06 '22 02:11

Martin Zeitler