Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 509087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:58:27+00:00 2026-05-13T06:58:27+00:00

I’m trying to build a JS Confirm Below leaving the page function The issue

  • 0

I’m trying to build a “JS Confirm Below leaving the page function”

The issue I’m having is that on the page I need this confirmation func I’m using CKEDITOR which creates an iframe for the text editor.

// Javascript code that controls the onbeforeunload event
function setConfirmUnload(on) {
    window.onbeforeunload = (on) ? unloadMessage : null;
}
function unloadMessage() {
    return 'You have entered new data on this page.  If you navigate away from this page without first saving your data, the changes will be lost.';
}
// JQuery code to the page with the form that we would like to control:
$(document).ready(function() {
    $(':input',document.newnote).bind("change", function() { setConfirmUnload(true); }); // Prevent accidental navigation away
});

How a can I BIND the iframe, so the script will catch changes in the iframe?

Here is the iFrame CKEDITOR creates:

<span lang="en" tabindex="0" title=" " dir="ltr" class="cke_skin_kama" onmousedown="return false;" id="cke_meeting_notes"><span class="cke_browser_gecko"><span class="cke_wrapper cke_ltr"><table cellspacing="0" cellpadding="0" border="0" style="width: 100%;" class="cke_editor"><tbody><tr style="-moz-user-select: none;"><td class="cke_top" id="cke_top_meeting_notes"><div class="cke_toolbox"><span class="cke_toolbar" id="cke_3"><span class="cke_toolbar_start"/><span class="cke_toolgroup"><span class="cke_button"><a onclick="CKEDITOR.tools.callFunction(3, this); return false;" onfocus="return CKEDITOR.ui.button._.focus(0, event);" onkeydown="return CKEDITOR.ui.button._.keydown(0, event);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" hidefocus="true" role="button" tabindex="-1" title="Bold" href="javascript:void('Bold')" class="cke_off cke_button_bold" id="cke_4"><span class="cke_icon"/><span class="cke_label">Bold</span></a></span><span class="cke_button"><a onclick="CKEDITOR.tools.callFunction(4, this); return false;" onfocus="return CKEDITOR.ui.button._.focus(1, event);" onkeydown="return CKEDITOR.ui.button._.keydown(1, event);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" hidefocus="true" role="button" tabindex="-1" title="Italic" href="javascript:void('Italic')" class="cke_off cke_button_italic" id="cke_5"><span class="cke_icon"/><span class="cke_label">Italic</span></a></span><span class="cke_button"><a onclick="CKEDITOR.tools.callFunction(5, this); return false;" onfocus="return CKEDITOR.ui.button._.focus(2, event);" onkeydown="return CKEDITOR.ui.button._.keydown(2, event);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" hidefocus="true" role="button" tabindex="-1" title="Underline" href="javascript:void('Underline')" class="cke_off cke_button_underline" id="cke_6"><span class="cke_icon"/><span class="cke_label">Underline</span></a></span></span><span class="cke_separator"/><span class="cke_toolgroup"><span class="cke_button"><a onclick="CKEDITOR.tools.callFunction(6, this); return false;" onfocus="return CKEDITOR.ui.button._.focus(3, event);" onkeydown="return CKEDITOR.ui.button._.keydown(3, event);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" hidefocus="true" role="button" tabindex="-1" title="Insert/Remove Numbered List" href="javascript:void('Insert/Remove Numbered List')" class="cke_off cke_button_numberedlist" id="cke_7"><span class="cke_icon"/><span class="cke_label">Insert/Remove Numbered List</span></a></span><span class="cke_button"><a onclick="CKEDITOR.tools.callFunction(7, this); return false;" onfocus="return CKEDITOR.ui.button._.focus(4, event);" onkeydown="return CKEDITOR.ui.button._.keydown(4, event);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" hidefocus="true" role="button" tabindex="-1" title="Insert/Remove Bulleted List" href="javascript:void('Insert/Remove Bulleted List')" class="cke_off cke_button_bulletedlist" id="cke_8"><span class="cke_icon"/><span class="cke_label">Insert/Remove Bulleted List</span></a></span></span><span class="cke_separator"/><span class="cke_toolgroup"><span class="cke_button"><a onclick="CKEDITOR.tools.callFunction(8, this); return false;" onfocus="return CKEDITOR.ui.button._.focus(5, event);" onkeydown="return CKEDITOR.ui.button._.keydown(5, event);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" hidefocus="true" role="button" tabindex="-1" title="Link" href="javascript:void('Link')" class="cke_off cke_button_link" id="cke_9"><span class="cke_icon"/><span class="cke_label">Link</span></a></span><span class="cke_button"><a onclick="CKEDITOR.tools.callFunction(9, this); return false;" onfocus="return CKEDITOR.ui.button._.focus(6, event);" onkeydown="return CKEDITOR.ui.button._.keydown(6, event);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" hidefocus="true" role="button" tabindex="-1" title="Unlink" href="javascript:void('Unlink')" class="cke_button_unlink cke_disabled" id="cke_10"><span class="cke_icon"/><span class="cke_label">Unlink<span class="cke_accessibility">, unavailable</span></span></a></span></span><span class="cke_toolbar_end"/></span><span class="cke_toolbar" id="cke_11"><span class="cke_toolbar_start"/><span class="cke_toolgroup"><span class="cke_button"><a onclick="CKEDITOR.tools.callFunction(10, this); return false;" onfocus="return CKEDITOR.ui.button._.focus(7, event);" onkeydown="return CKEDITOR.ui.button._.keydown(7, event);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" hidefocus="true" role="button" tabindex="-1" title="Cut" href="javascript:void('Cut')" class="cke_off cke_button_cut" id="cke_12"><span class="cke_icon"/><span class="cke_label">Cut</span></a></span><span class="cke_button"><a onclick="CKEDITOR.tools.callFunction(11, this); return false;" onfocus="return CKEDITOR.ui.button._.focus(8, event);" onkeydown="return CKEDITOR.ui.button._.keydown(8, event);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" hidefocus="true" role="button" tabindex="-1" title="Copy" href="javascript:void('Copy')" class="cke_off cke_button_copy" id="cke_13"><span class="cke_icon"/><span class="cke_label">Copy</span></a></span><span class="cke_button"><a onclick="CKEDITOR.tools.callFunction(12, this); return false;" onfocus="return CKEDITOR.ui.button._.focus(9, event);" onkeydown="return CKEDITOR.ui.button._.keydown(9, event);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" hidefocus="true" role="button" tabindex="-1" title="Paste" href="javascript:void('Paste')" class="cke_off cke_button_paste" id="cke_14"><span class="cke_icon"/><span class="cke_label">Paste</span></a></span><span class="cke_button"><a onclick="CKEDITOR.tools.callFunction(13, this); return false;" onfocus="return CKEDITOR.ui.button._.focus(10, event);" onkeydown="return CKEDITOR.ui.button._.keydown(10, event);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" hidefocus="true" role="button" tabindex="-1" title="Paste as plain text" href="javascript:void('Paste as plain text')" class="cke_off cke_button_pastetext" id="cke_15"><span class="cke_icon"/><span class="cke_label">Paste as plain text</span></a></span></span><span class="cke_toolbar_end"/></span><span class="cke_toolbar" id="cke_16"><span class="cke_toolbar_start"/><span class="cke_toolgroup"><span class="cke_button"><a onclick="CKEDITOR.tools.callFunction(14, this); return false;" onfocus="return CKEDITOR.ui.button._.focus(11, event);" onkeydown="return CKEDITOR.ui.button._.keydown(11, event);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" hidefocus="true" role="button" tabindex="-1" title="Undo" href="javascript:void('Undo')" class="cke_button_undo cke_disabled" id="cke_17"><span class="cke_icon"/><span class="cke_label">Undo<span class="cke_accessibility">, unavailable</span></span></a></span><span class="cke_button"><a onclick="CKEDITOR.tools.callFunction(15, this); return false;" onfocus="return CKEDITOR.ui.button._.focus(12, event);" onkeydown="return CKEDITOR.ui.button._.keydown(12, event);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" hidefocus="true" role="button" tabindex="-1" title="Redo" href="javascript:void('Redo')" class="cke_button_redo cke_disabled" id="cke_18"><span class="cke_icon"/><span class="cke_label">Redo<span class="cke_accessibility">, unavailable</span></span></a></span></span><span class="cke_separator"/><span class="cke_toolgroup"><span class="cke_button"><a onclick="CKEDITOR.tools.callFunction(16, this); return false;" onfocus="return CKEDITOR.ui.button._.focus(13, event);" onkeydown="return CKEDITOR.ui.button._.keydown(13, event);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" hidefocus="true" role="button" tabindex="-1" title="Remove Format" href="javascript:void('Remove Format')" class="cke_off cke_button_removeFormat" id="cke_19"><span class="cke_icon"/><span class="cke_label">Remove Format</span></a></span></span><span class="cke_toolbar_end"/></span><span class="cke_toolbar"` id="cke_20"><span class="cke_toolbar_start"/><span class="cke_toolgroup"><span class="cke_button"><a onclick="CKEDITOR.tools.callFunction(17, this); return false;" onfocus="return CKEDITOR.ui.button._.focus(14, event);" onkeydown="return CKEDITOR.ui.button._.keydown(14, event);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" hidefocus="true" role="button" tabindex="-1" title="Text Color" href="javascript:void('Text Color')" class="cke_off cke_button_textcolor" id="cke_21"><span class="cke_icon"/><span class="cke_label">Text Color</span><span class="cke_buttonarrow"/></a></span><span class="cke_button"><a onclick="CKEDITOR.tools.callFunction(18, this); return false;" onfocus="return CKEDITOR.ui.button._.focus(15, event);" onkeydown="return CKEDITOR.ui.button._.keydown(15, event);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" hidefocus="true" role="button" tabindex="-1" title="Background Color" href="javascript:void('Background Color')" class="cke_off cke_button_bgcolor" id="cke_22"><span class="cke_icon"/><span class="cke_label">Background Color</span><span class="cke_buttonarrow"/></a></span></span><span class="cke_toolbar_end"/></span><span class="cke_toolbar" id="cke_23"><span class="cke_toolbar_start"/><span class="cke_toolgroup"><span class="cke_button"><a onclick="CKEDITOR.tools.callFunction(19, this); return false;" onfocus="return CKEDITOR.ui.button._.focus(16, event);" onkeydown="return CKEDITOR.ui.button._.keydown(16, event);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" hidefocus="true" role="button" tabindex="-1" title="Maximize" href="javascript:void('Maximize')" class="cke_off cke_button_maximize" id="cke_24"><span class="cke_icon"/><span class="cke_label">Maximize</span></a></span></span><span class="cke_toolbar_end"/></span></div><a onclick="CKEDITOR.tools.callFunction(20)" class="cke_toolbox_collapser" id="cke_25"/></td></tr><tr><td style="height: 370px;" class="cke_contents" id="cke_contents_meeting_notes" role="region" title="Rich text editor, meeting_notes"><iframe frameborder="0" tabindex="-1" allowtransparency="true" style="width: 100%; height: 100%;" role="region" title=" "/></td></tr><tr style="-moz-user-select: none;"><td class="cke_bottom" id="cke_bottom_meeting_notes"><div class="cke_path" id="cke_path_meeting_notes"><a onclick="return CKEDITOR._.elementsPath.click('meeting_notes',1);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" onkeydown="return CKEDITOR._.elementsPath.keydown('meeting_notes',1, event);" hidefocus="true" title="body element" tabindex="-1" href="javascript:void('body')" id="cke_elementspath_2_1">body</a><a onclick="return CKEDITOR._.elementsPath.click('meeting_notes',0);" onblur="this.style.cssText = this.style.cssText;" onkeypress="return false;" onkeydown="return CKEDITOR._.elementsPath.keydown('meeting_notes',0, event);" hidefocus="true" title="p element" tabindex="-1" href="javascript:void('p')" id="cke_elementspath_2_0">p</a><span class="cke_empty"> </span></div><div onmousedown="CKEDITOR.tools.callFunction(2, event)" title="Drag to resize" class="cke_resizer"/></td></tr></tbody></table><style>.cke_skin_kama{visibility:hidden;}</style></span></span></span>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:58:27+00:00Added an answer on May 13, 2026 at 6:58 am

    Like this:

    $(':input', document.newNote.contentWindow.document).change(...);
    

    Assuming that document.newNote is the IFRAME.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 357k
  • Answers 357k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The other answers are correct. Here is some code you… May 14, 2026 at 9:40 am
  • Editorial Team
    Editorial Team added an answer you ruin the noConflict concept by reassigning the jquery to… May 14, 2026 at 9:40 am
  • Editorial Team
    Editorial Team added an answer If you get that particular error, you don't actually have… May 14, 2026 at 9:40 am

Related Questions

No related questions found

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.