开发者

jquery don't (or remove) focus on any form field [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Jquery Unfocus

Have a form with just one password field tag, and as I use palceholder, I don't want to have automatic 开发者_如何转开发input focus. How can I set no focus at all within jquery?

Thanks, Markus


I'm not fully clear on what you need, but I think you're looking for something like this:

$("input").blur();

That will remove the focus from any input element that may have it.


You can disable the field. $('input.my-input').attr('disabled', true); Then re-enable it when you want to allow input (on click or whatever). You'd have to use some CSS (.my-input:disabled { ... }) to make sure the browser doesn't grey it out.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜