views:

28

answers:

0

I am having an issue with jQuery, an iframe, and a third party component. (Richer Components rich text box, I suggest not using their product as they do not respond to issues on their forums, or at least have not for at least 5 years.)

I am trying to have when a user types into a third party control an event fires. The control is a rich text editor. The control has an iframe that inserts content into it as the user types. The iframe has an id html_text_x5

I am needing to, when the user types, hook into a client side event. The event I need fired is SetShowSaveModalWindow.

I have

$(function()
{
    alert("Initializing..");
    $('#html_text_x5').load(Hello);
    Hello();
});

function Hello()
{
    alert("loaded");
    $('#html_text_x5').contents().keyup(SetShowSaveModalWindow);
}

function SetShowSaveModalWindow()
{
    // does work...
}

that works sometimes. I have tried it without the line $('#html_text_x5').load(Hello); and without the line Hello();.

Is there any reason why this would work sometimes but not all the time? Could the iframe be loading too early?

I have also tried in the Hello function adding:

var foo = $('#html_text_x5').contents();
foo.change(SetShowSaveModalWindow);
foo.keyup(SetShowSaveModalWindow);
foo.keydown(SetShowSaveModalWindow); 

which does not work as well.