Changing the value of a jQuery mobile button using

2020-05-25 07:15发布

Wondering if you can help me out. I seem to have a problem changing the text of my jQuery Mobile buttons with jQuery.

$("#myButton .ui-btn-text").text("New text"); 

Code above which was recommended for a related question doesn't seem to work.

Neither does:

$("#myButton").attr(value,"New Test");

The code for my button is as followed:

<input type="button" name="answer" id="myButton" data-theme="b" data-answer="4" value="next"></button>

I'll appreciate any feedback guys. Thanks

7条回答
老娘就宠你
2楼-- · 2020-05-25 08:03

Updated the following works for me (similar to the answer from kovač):

$('#MyButton').html('changed value').button('refresh');

or

$("#MyButton").val("changed value").button("refresh");
查看更多
登录 后发表回答