JQuery Mobile Custom Theme Buttons

后端 未结 1 516
别那么骄傲
别那么骄傲 2021-01-21 16:17

I just started using a jquery mobile custom theme instead of one of the defaults. Lots of issues...but the current one is that dynamically created buttons don\'t work as expecte

相关标签:
1条回答
  • 2021-01-21 16:36

    data-role=button is deprecated so you need to add classes manually and it doesn't require any manual enhancement even if you append them dynamically. .button() is used for <input type=button> only.

    Your solution is as follows:

    var Btn = '<a href="#" class="ui-btn ui-btn-Custom ui-btn-icon-Position ui-icon-Name">Button</a>';
    
    $(".selector").append(Btn);
    
    • ui-btn-Custom: is theme swatch i.e. ui-btn-a

    • ui-btn-icon-Position: icon's position, left,right,top,bottom or notext i.e. ui-btn-icon-left

    • ui-icon-Name: icon's image i.e. ui-icon-home

    Demo

    0 讨论(0)
提交回复
热议问题