开发者

jQuery - focus inside an iframe?

开发者 https://www.devze.com 2023-02-28 11:22 出处:网络
I\'m using a wysiwug jQuery plugin that creates an iframe for my textarea like this: <div class=\"wysiwyg\" style=\"width: 581px;\">

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.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body style="margin开发者_JAVA百科: 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?


var frameBody = $("#id_message_bodyIFrame").contents().find("body");

frameBody.focus(function(){ /* ... */ });
frameBody.click(function(){ /* ... */ });
frameBody.keyup(function(){ /* ... */ });
0

精彩评论

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