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 7038279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:38:59+00:00 2026-05-28T01:38:59+00:00

I am developing a wysiwyg HTML editor using javascript and an editable iframe. Prior

  • 0

I am developing a wysiwyg HTML editor using javascript and an editable iframe. Prior to developing the editor, I did some research into other HTML editors that use javascript and iframes (including CKEditor), and there is one feature that I am struggling to duplicate.

In some iframe/JS-based HTML editors, if a user wishes to access or edit an element’s attributes (e.g. image dimensions, hyperlink url, table width), they can simply double click the element and a modal div will appear with text boxes containing the attribute values of that element and/or those of the elements within that element.

So far, the closest that I have came to developing a feature like this was to create a script that alerts the HTML code of an area within the iframe that the user double clicks on. I added this code to my HTML page;

<iframe name="wysiwyg" id="wysiwyg" onload="dblClick();"></iframe>

and added this code to my javascript file;

function dblClick(){
        document.getElementById("wysiwyg").contentWindow.document.ondblclick=dblClicked;
        window.frames["wysiwyg"].document.body.ondblclick=dblClicked;
}

function dblClicked (){
        txt = wysiwyg.document.selection.createRange().htmlText;
        alert(txt);
}

The problem is that this code only works when a user double clicks and highlights a section of text, for example, double clicking a selection of bold text would alert this piece of code to the user;

<b>text</b>

Anything else that I double click on alerts an error message. Furthermore, it only works properly in Internet Explorer. When I tested it in Firefox, Opera, Chrome, and Safari, the script either did not work or did not work properly (in Firefox, the script alerted error messages as soon as the page was loaded).

What I need is a script that allows the end user to view all the properties of any element they double click on within the editable iframe and works in all major browsers.

I know it would be easier to simply use an existing wysiwyg editor, but I prefer to create my own from scratch as I enjoy the challenge. Also, I know CKEditor does not appear to use iframes like mine, but I am referencing it as an example of the sort of functionality that I wish to achieve.

Any help would be appreciated.

  • 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-28T01:39:00+00:00Added an answer on May 28, 2026 at 1:39 am

    There are various problems/misunderstandings here:

    • You’re only using IE’s old selection and TextRange API, which is not supported in other browsers;
    • You seem unsure about how access the iframe’s document and are attaching the dblclick handler twice, unnecessarily.
    • CKEditor does use iframes

    I’d suggest skipping the selection stuff and using event delegation to get the element that was double clicked, which will work in all major browsers.

    var iframeWin;
    
    function dblClick() {
        iframeWin = document.getElementById("wysiwyg").contentWindow;
        iframeWin.document.ondblclick = dblClicked;
    }
    
    function dblClicked(evt) {
        evt = evt || iframeWin.event;
        var target = evt.target || evt.srcElement;
        alert(target.tagName);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a WYSIWYG editor using the iframe technique. I need to know
I am developing a simple WYSIWYG RTF editor in Java and have a small
I am developing some basic utility objects in javascript. These are things like: spinner
Developing a website and just trying to get back into the swing of (clever)
Developing a project of mine I realize I have a need for some level
When developing a new web based application which version of html should you aim
After developing in VS.NET for many years, I'm starting to do some Xcode development
When developing Flex projects, Eclipse gives warnings about the default index.html file generated by
Developing a simple game for the iPhone, what gives a better performance? Using a
Does anyone know what my options are for Web-based WYSIWYG editors (the type which

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.