开发者

setting focus on text-box

I am using jquery accordion effect when the clicks on a particular div the content of div appears ,i need 开发者_运维技巧the focus on a text-box inside the div?


If you have the id of the text box, you could do the following:

$("#yourtextbox").focus();


You'll need to make use of the jQuery focus method:

$(div).click(function(){
  $(this).children("#win").focus();
});

Or if it's the only textbox with that ID (which it should be if you're using an ID), just call:

$("#win").focus();


You can use Jquery function focus(), somthing like this: (for first input field in a div without id)

<div id="myDiv" onclick="$('input', this).focus();">
<input type="text" name="some_name" value="">
</div>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜