简体   繁体   中英

Jquery UI button issue

Please take a look at this

http://jsfiddle.net/WAre9/4/

The problem is, after changing the text of link, .button() doesn't work properly.

Here is scrshot before:

在此输入图像描述

And after mouse click:

在此输入图像描述

As you see all paddings, font styles have gone. Any suggestion? How to fix this problem?

This is from How do I replace jQueryUI button text?

Maybe you could use the label option of the jQuery UI button now instead?

 $("#mybutton").button().toggle(function() { $(this).button('option', 'label', 'Stop'); }, function() { $(this).button('option', 'label', 'Start'); }); 

jsbin preview here

It's because the span tag is removed after setting element.text see this fiddle:

http://jsfiddle.net/WAre9/8/

or you can just change text of span element:

http://jsfiddle.net/WAre9/10/

http://jsfiddle.net/Bue3B/

use children('span').text...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM