jQuery Mobile选择焦点上的输入文本

jQuery Mobile选择焦点上的输入文本,jquery,select,mobile,focus,highlight,Jquery,Select,Mobile,Focus,Highlight,我正在使用jQuery mobile,现在我想在点击时突出显示一个输入文本字段 我用这个: $(document).ready(function() { $('.highlight').focus(texty_focus); }); function texty_focus() { var input = $(this); setTimeout(function() { input.select(); },10); } 但我的手机没用。有什么建

我正在使用jQuery mobile,现在我想在点击时突出显示一个输入文本字段

我用这个:

$(document).ready(function() {
    $('.highlight').focus(texty_focus);
});
function texty_focus() {
    var input = $(this);
    setTimeout(function() { 
        input.select();
    },10);
}

但我的手机没用。有什么建议吗?

也许你可以试试这个:

$(document).ready(function() {
     $('.highlight').click(function(){
         var input = this;
         input.focus();
         input.setSelectionRange(0,999); 
     });
});

你有这个问题的实例吗?现在就用我最近的更改试试看。但是,有没有办法使字段只读?我试图使用
readonly=“readonly”
,但高亮显示不起作用(在手机上)。不确定该如何工作。。。我建议编写一个JavaScript函数,防止更改,但仍然保持输入框的默认功能(可能还有另一个问题)