jQuery UI dialog button focus

前端 未结 13 2190
时光取名叫无心
时光取名叫无心 2020-12-13 12:08

When a jQuery UI dialog opens, it selects one of the buttons and highlights it or sets focus to it etc... How can I stop this behaviour so that none of the buttons are highl

13条回答
  •  长情又很酷
    2020-12-13 12:36

    I stumbled upon a little hack to fix this that others may find useful. A solution like this seems to work for me:

    $( "#button" ).click(function() {                                   
        // this is a hack to prevent the focus from remaining after a click
        $(this).toggle(this.checked);                                       
    });
    

    It simply programmatically sets it checked again, which seems to clear up the focus issue.

提交回复
热议问题