开发者

multiple focused elements in the browser

Is it possible to have multiple elements (such as input elements) focused in the browser.

I would like to reproduce the effect of Sublime Tex开发者_开发知识库t 2.


It doesn't seem possible.

Check out this test:

$('#one').focus(function(){
    $('#one, #two').focus();
});

Example: http://jsfiddle.net/jasongennaro/epBea/

EDIT

If you wanted both fields to look like they had focus, you could fake this by adding divs around the inputs and styling with a border on focus.

$('#one').focus(function(){
    $('#one, #two').parent().css('border','1px solid red');
});

You also need to remove the outline for each input in the css.

Example 2: http://jsfiddle.net/jasongennaro/epBea/1/

Warning: I think this is a bad usability idea, as focus is meant to tell people which field they are working in.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜