ContentEditable Problem

Jul 23, 2005

Is it possible to make a SELECT box editable, where a user can type their own entry to be acted upon on top of being able to select an option of course?

View 2 Replies


ADVERTISEMENT

ContentEditable DIV & Document.body

Dec 7, 2006

Does a contentEditable DIV have the notion of an internal document? I'm trying to convert code that uses an IFrame.contentWindow.document to use the "document" inside a contentEditable DIV but they don't seem to be similar beasts. Eventually I want to add stylesheets to the contentEditable DIV as well as event handling. I'm porting an IFrame editor to a contentEditable DIV based editor.

View 1 Replies View Related

Set Caret Position In Contenteditable Div

Sep 21, 2010

I have a contenteditable div, it has some paragraphs in it.Assuming a situation, when I click the button "set caret position", the main div will focus, the caret will start at position number 8 of second paragraph, which means the caret will appear after the word "draw".How would you do it?

View 8 Replies View Related

JQuery :: Getting Caret Position In A Contenteditable Div?

Nov 16, 2010

I'm using a div with contenteditable=true, and I need to know where the caret is for operations like splitting the html contents of that div where the caret is. Ultimately, if a piece of text is selected, I'll want to split that html content on the selection start / end.jCaret only seems to work for textareas.Is this possible in a div?

View 1 Replies View Related

Saving/restoring Caret Position In A ContentEditable Div

Feb 2, 2005

I have a contentEditable element, and am using setTimeout() to call a function which changes the innerHTML of the div. Problem is that changing innerHTML moves the caret to the end of the text.

I need to keep the caret pos so the user can keep typing. I tried storing the caret pos with
cursorPos=document.selection.createRange().duplicate();

And then later restoring it with cursorPos.select() - which is IE only, but it doesn't work because the content of the div gets changed between calls, and the behavior is undefined (it basically selects everything) ...

View 1 Replies View Related

Reloading ContentEditable Area When Visitor Clicks On Back Button

Jul 30, 2007

I'm building a rich editor to replace a textarea, and am about to
release it as "live." But there's one last thing I want to do with it.

When using a textarea, if the visitor clicks on "back" then the
information is (usually) still there. But with the contenteditable
field, it's gone.

I read on a web page a few days ago that there was an easy solution to
this, but I didn't save the information and didn't save the page. Any
ideas?

View 2 Replies View Related

Using "contentEditable" On Span And Auto-selecting On Click

Dec 1, 2009

I have contentEditable="true" on some span tags on my page. The idea is to allow admin users to edit content inline on the page without having to send them to a giant form page. When only using contentEditable="true" it works fantastically. You can click into the span and type away. Now, the admin users want the text to be selected in the span once they click into it or bring focus to it by tabbing. I'm using the following function onclick and onfocus to get this working:

Code:
function selectText(el)
{
var span = $(el);
// FIREFOX
if (Browser.Engine.gecko) {
var div = document.createRange();
div.setStartBefore(span);
[Code]...

View 2 Replies View Related

Emulating Div ContentEditable = "true" With Textarea

Aug 7, 2011

I'm trying to emulate exactly how a div with the attribute contentEditable = "true" would operate using a textarea...trying and failing. I found some code somewhere which attempts to do something like his but it isn't working well for me.

I want to do this without jquery and with javascript only. The best example I can think of is Facebook's text area that you use to write on somebody's wall.

Here's my sizing function

Code:

And here's my text area:-

Code:

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved