Solved

how to make Mozilla contenteditable working

Posted on 2004-10-17
6
841 Views
Last Modified: 2012-05-05
Hello, Currently, I get to know the contentEditable also works in Mozilla firefox. I have seen such examples from internet. But when I try it, it doesn't work. Does any one have some suggestion about my piece of code

<html>
<head>
</head>
<body>

<div style="contentEditable='true';">
Editable area
</div>

</body>
</html>

When I view this code from Mozilla firefox and press F7, there is really the cursor shown on my area of code, but when I type something, nothing inserted in that area. Does any one have some idea how should it work? Thanks a lot in advance!

BR
0
Comment
Question by:SBUH
  • 4
6 Comments
 
LVL 6

Expert Comment

by:superm401
ID: 12516190
Okay, first of all, I haven't quite figured it out yet.  However, I can tell you for certain that F7 has nothing to do with contentEditable, if that feature is implemented at all in Mozilla Firefox, which unfortunately I am beginning to doubt.  Instead, it refers to Caret Browsing, which lets you move through text using a caret cursor, regardless of whether contentEditable is on.  They are totally separate.  Can you give me a page that supports the contentEditable feature on Mozilla Firefox please?

P.S. In your own example, contentEditable is not a valid CSS property, but if it was you would access it like this:

<div style="contentEditable:'true';">
0
 
LVL 6

Accepted Solution

by:
superm401 earned 65 total points
ID: 12516381
I've got it.

Source code below:

<html>
<head>
<SCRIPT src="http://mozile.mozdev.org/mozile/mozileLoader.js">

<TITLE>Content Edit Test</TITLE>
</head>
<body>
<P>
This is a filler paragraph.
<P>
This is a second filler paragraph.
<P>
This is a final filler paragraph.  They are here only to ensure the editing interface does not block the paragraph to be edited.
<P>
<div style="-moz-user-modify: read-write;-moz-user-input: enabled;-moz-user-select: normal;">
Editable area
</div>

</body>
</html>



Note:  The extra text is there only to keep the editing interface in view, as stated.  For it to work, you need to have the whole div and the script tag at the top:

<SCRIPT src="http://mozile.mozdev.org/mozile/mozileLoader.js">

Of course, you can change the start value for the editable text, from "Editable area" to something else.  


For a working demo, see: http://home.comcast.net/~superm40/editdemo.html
0
 
LVL 6

Expert Comment

by:superm401
ID: 12518272
Let me make a slight correction to my earlier comments.  F7 is useful for content editing only in that it can allow you to create a caret cursor if this is not done automatically.
0
 
LVL 6

Expert Comment

by:superm401
ID: 12518278
And the cursor probably won't be created automatically.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question