input标签添加style=“-webkit-user-select: auto;”
代码语言:javascript复制<script>
$(function(){
//$('input').focus(focustext)
/*******用以下三行代码即可实现*******/
$('input').click(function(){
this.selectionStart = 0;
this.selectionEnd = this.val().length;
})
})
function focustext() {
var input = this;
setTimeout(function(){ input.selectionStart = 0; input.selectionEnd = input.val().length; }, 100)
}
</script>