admin管理员组文章数量:1403522
I'm using a wysiwug jQuery plugin that creates an iframe for my textarea like this:
<div class="wysiwyg" style="width: 581px;">
<ul class="panel" role="menu">
<div style="clear: both;"></div>
<iframe id="id_message_bodyIFrame" frameborder="0" src="javascript:false;" style="min-height: 170px; width: 573px;" tabindex="0">
<html xml:lang="en" xmlns="">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body style="margin: 0px;">
DETECT WHEN I START TYPING TEXT HERE <--------
</body>
</html>
</iframe>
</div>
<textarea id="id_text_area" name="message_body" cols="70" rows="10" style="display: none;"></textarea>
</div>
I want to be able to detect when I start typing text inside of the body
of the iframe
, something like focus()
does on text inputs. Any ideas?
I'm using a wysiwug jQuery plugin that creates an iframe for my textarea like this:
<div class="wysiwyg" style="width: 581px;">
<ul class="panel" role="menu">
<div style="clear: both;"></div>
<iframe id="id_message_bodyIFrame" frameborder="0" src="javascript:false;" style="min-height: 170px; width: 573px;" tabindex="0">
<html xml:lang="en" xmlns="http://www.w3/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body style="margin: 0px;">
DETECT WHEN I START TYPING TEXT HERE <--------
</body>
</html>
</iframe>
</div>
<textarea id="id_text_area" name="message_body" cols="70" rows="10" style="display: none;"></textarea>
</div>
I want to be able to detect when I start typing text inside of the body
of the iframe
, something like focus()
does on text inputs. Any ideas?
-
I don't think
focus()
works on anything other than form elements or links. – Mottie Commented Apr 25, 2011 at 22:27 - @fudgey Are there any other ways to acplish the same thing without the focus ()? – avatar Commented Apr 25, 2011 at 23:39
1 Answer
Reset to default 5var frameBody = $("#id_message_bodyIFrame").contents().find("body");
frameBody.focus(function(){ /* ... */ });
frameBody.click(function(){ /* ... */ });
frameBody.keyup(function(){ /* ... */ });
本文标签: javascriptjQueryfocus inside an iframeStack Overflow
版权声明:本文标题:javascript - jQuery - focus inside an iframe? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744354445a2602235.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论