改变使用jQuery Mobile的按钮上的文字。 [英] change text on button using jquery mobile.
问题描述
我想使用jQuery移动来改变按钮文本。如果我改变数据作用没有,后来我失去格式化它的工作原理。
<字段集类=UI并网数据列直插式=真正的>
< DIV CLASS =UI-块一个><按钮类=cl_button1类型=提交
数据主题=C数据图标=家的数据iconpos =顶>点击ME< /按钮>
< / DIV>
< /字段集>
$('。cl_button1)VAL(一些文本)。
另外一个帖子提出这一点,但没有奏效。
$(cl_button1的.ui-BTN-文)文本(一些文字);
所有,
以上的解决方案似乎不JQM 1.1.1工作。这样做的一个非常简单的方法是调用。
$('cl_button1。)文本(一些文本)按钮(刷新)。
根据 http://jquerymobile.com/test/docs/buttons/按钮-methods.html ,只有三种方法可以在一个按钮来调用。这应该让你的按钮的内部状态相协调,与JQM UI装饰,并针对变化的方式按钮,更稳健的未来是由'pretty。
I would like to change text on button using jquery mobile. It works if I change data-role to none, but then I lose formatting.
<fieldset class="ui-grid-a" data-inline="true">
<div class="ui-block-a"><button class="cl_button1" type="submit"
data-theme="c" data-icon="home" data-iconpos="top">Click Me</button>
</div>
</fieldset>
$('.cl_button1').val('some text');
Another posting suggested this, but it did not work.
$("cl_button1 .ui-btn-text").text("some text");
All,
The above solutions do not seem to work with JQM 1.1.1. A very simple way of doing this is to call.
$('.cl_button1').text('some text').button('refresh');
As per http://jquerymobile.com/test/docs/buttons/buttons-methods.html, there are only three methods you can call on a button. This should keep the internal state of your button consistent with the JQM UI adornment, and be more robust against changes to the way buttons are made 'pretty' in the future.
这篇关于改变使用jQuery Mobile的按钮上的文字。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!