JQueryUI dialog - button text is not displayed

I have a strange error in a dialog, I load the dialog fine, but whenever I assign a button to it, although a button will be displayed on it, it will not display the name of the button, Here is my code that successfully starts the dialog ...

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 html result from bugzilla after loading the popup ...

 < 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 an area that should contain text, but as you can see, it is not. Any ideas?

+7
source share
7 answers

It inspired me a lot, but it didn’t work for me, I made the following changes. I think this works better.

 $('div.ui-dialog-buttonset button.ui-button span.ui-button-text').each(function() { $(this).html($(this).parent().attr('text')); }); 
+4
source

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

 $('div.ui-dialog button.ui-button').each(function() { $(this).children('.ui-button-text').html($(this).attr('text')); }); 
+4
source

I think something is missing. It would be nice to see that it works. I tried to create a test and I am not getting text, but css is missing. If I do this, it works:

 <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">Text Here</span></button> 
0
source

Sorry, new to SO.

Anyway, since this piece of code was just part of more functionality, and since I could not solve the problem using the sample code on the jQueryUI site, I ended up deciding:

 var button1_text = ''; (ui_popup_but1 != '') ? button1_text = ui_popup_but1 : button1_text = 'OK'; jQuery('button[text="button1"] span').html(button1_text); 
0
source

I had a similar problem. Finally, I solved it by updating the version of jQuery used from 1.3.2 to the current (1.7.1) at that time. I just noticed that the jQuery UI version that I used is not current (1.8.11 vs current 1.8.18). I will try to override jQuery and upgrade the jQuery user interface to the current one and see what happens.

EDIT: jQuery UI 1.8.18 fixed the problem for me using both jQuery 1.3.2 and 1.7.1, so it looks like 1.8.11, there was a defect due to which it is incompatible with 1.3.2 (I "It was assumed that it should be from the age of 18. I think that they would not change the compatibility between such a small version change. "

0
source

Had the same problem and finished fixing jquery-ui.js

 --- jquery-ui-1.8.23.js 2012-09-14 11:18:34.000000000 +-1000 +++ jquery-ui-1.8.23.js 2012-09-14 11:31:07.000000000 +-1000 @@ -9088,13 +9088,16 @@ .appendTo(uiButtonSet); // can't use .attr( props, true ) with jQuery 1.3.2. $.each( props, function( key, value ) { if ( key === "click" ) { return; } - if ( key in button ) { + if ( key == "text" ) { + button.html( value ); + } + else if ( key in button ) { button[ key ]( value ); } else { button.attr( key, value ); } }); if ($.fn.button) { 
0
source

I had the same problem, but the reason it was without text was because I had problems with addiction. In short, I had 2 jquery ui js included in my last html file. When I left only one version of jquery ui, everything seems to work as expected.

0
source

All Articles