Change button text jquery mobile

后端 未结 10 920
傲寒
傲寒 2020-11-29 04:32

I\'m using the new jquery mobile 1.0 alpha 1 release to build a mobile app and I need to be able to toggle the text of a button. Toggling the text works fine, but as soon a

10条回答
  •  野性不改
    2020-11-29 05:16

    I read through this and various options online and think I may have a simpler solution. It definitely works for links you are turning into a button with the data-role="button" attribute.

    Simply put the text of the button in a separate span, and then change the contents of the span in your JavaScript.

    e.g.

    Mark Old
    

    Then a simple

    $('#oldBtnText').html("Old");
    

    Will do the job. It also shouldn't be a problem if jQuery changes their structure.

提交回复
热议问题