Am just wondering if there is a way to give focus to a non-form element. I am asking because I am using the jhtmlArea plugin (http://jhtmlarea.codeplex.com/ - page currently down) in a project. And it does work, except that since it masks an IFRAME over a TEXTAREA the IFRAME, not being a form element, doesn't seem to want to receive focus. I think the demo on the official plugin page may have shown the IFRAME getting focus on load but I can't remember for sure and can't check now due to the plugin demo page not loading.

没有正确的解决方案

其他提示

Finally got it to work in my project but for some reason when I put the solution into the jsfiddle it only works in Chrome: http://jsfiddle.net/7kTrB/8/

The following line seems to be the most relevant part:

this.iframe[0].contentWindow.focus();
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top