disable <button> with jQuery Mobile causes frame

匆匆过客 提交于 2020-01-11 11:21:11

问题


i am using jquery 2.0 with jquery mobile 1.4.

if i disable a there is a Frame around the Button. It's still there if i enable the button again.

$("#speichern").button({disabled:true});  

button tag:

<button id="artSave" class="ui-btn ui-icon-plus ui-btn-icon-left ui-corner-all ui-btn-b"> speichern</button>

i don't like to use an anchor, because it can't disable the button fully. i also had some drawbacks with

picture of frame around the button

thanks a lot


回答1:


To disable a button or a tags, add class ui-state-disabled. Use .button() widget only with input that has type button, submit or reset.

When you use .button() on any element other than input, you convert it into an input button and hence you get a wrapper around it.

  • Disable/Enable an input button:

    $(".selector").button("disable");
    $(".selector").button("enable");
    
  • Disable/Enable button tag:

    $(".selector").addClass("ui-state-disabled");
    $(".selector").removeClass("ui-state-disabled");
    
  • Disable/Enable a anchor tag:

    $(".selector").addClass("ui-state-disabled");
    $(".selector").removeClass("ui-state-disabled");
    

Demo



来源:https://stackoverflow.com/questions/21726283/disable-button-with-jquery-mobile-causes-frame

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!