views:

331

answers:

3

Hello everybody.

I am setting up a own made wysiwyg plugin for jQuery. He is almost finished but know i want to add a keyup event to a iframe with designmode on. But i can't get it worked. I tryied almost everything a found on the internet. The class of the wysiwyg iframe with designmode is .dhwysiwyg. I though the next code will work:

$(function () {
$('.dhwysiwyg', container).keyup(function () {
// the script
});
});

But this won't work. The keyup event don't exists.

Can someone help me?

Tom

A: 

I'm not sure about the particulars of your example, but I know that pushing events to an iFrame will sometimes violate the security policy of your browser.

Matt Lehmann
A: 

I've never heard of this "design mode" thing (only contentEditable) but your problem might be a security limitation. What are the iframe contents, and are they on the same domain?

Bart van Heukelom
+2  A: 

Does the page in your iframe load its own copy of jQuery? If so, try this in your outer page (the page with the iframe in it, not the page in the iframe):

$(function() {
  var frameWindow = $('.dhwysiwyg').get(0).contentWindow;
  frameWindow.$('body').keyup(function() {
    // handler
  });
});
Pointy