I have a <input type="text" 开发者_如何学JAVAvalue="Hi! Enter Here" >
How to open this in selected mode and cursor on the input field.
We just start writting into it
use jquery focus()
function
$('input').focus();
Or better
<input type="text" value="Hi! Enter Here" id="someid">
and
$('#someid').focus();
check working example here.
For select and focus
$('#someid').focus().select();
or
$('#someid').focus(function (){$(this).select();});
On jsfiddle.net
$("input").focus();
Read more at http://api.jquery.com/focus/
Set the id of the input
<input type="text" id="myText" value="Hi! Enter Here" >
Then add this jQuery
$(function() {
$("#myText").focus();
});
精彩评论