Questions tagged [contenteditable]

contentEditable is an HTML attribute (invented by Microsoft and standardized in HTML5) that is used for client-side in-browser "rich text" editing.

There are really two attributes involved, designMode and contentEditable. The designMode attribute governs the entire document (i.e. it makes the entire document editable, like a dedicated HTML editor). The contentEditable attribute governs just the element on which it appears, and that element's children -- like a rich text editor control within a page.

Resources

2552 questions
1
vote
1 answer

Save changes made to "contentEditable" sections back to original HTML file

How could I save changes made to "contentEditable" sections back to original HTML file. Is this even possible? I need to create a single html file that has sections for user changes. Using their web browser, I would like the user to be able to…
JonHTML
  • 11
  • 1
  • 4
1
vote
0 answers

using contenteditable in a php generated table to update mysql

supposing you have a table generated via php from a mysql database, eg,
gungu
  • 161
  • 1
  • 1
  • 9
1
vote
1 answer

Adding DOM elements using contentEditable

I've created an editable div, and I want to replace smiley signs with smiley images. But whenever I replace a string with a dom element ( or or whatever..), the div stops being editable (i.e. I can see the caret when I click on text, but…
zorglub76
  • 4,852
  • 7
  • 37
  • 46
1
vote
1 answer

Firefox: contenteditable missing cursor on last empty text node

I'm trying to make a simple editable list using contenteditable, turns out it's more difficult than I first assumed. Here's the simplest example to demonstrate the problem.

1

Alex Latchford
  • 655
  • 1
  • 9
  • 17
1
vote
1 answer

Setting and getting selectionrange/caret position in contenteditable div element (dart)

I'm trying to swith from using a textarea element for my editor to a
element. I have only one problem that is that I can't use textarea.selectionStart, textarea.selectionEnd, textarea.setSelectionRange() anymore.…
90intuition
  • 966
  • 3
  • 12
  • 25
1
vote
2 answers

Extra div added on chrome while copy paste into contenteditable div

I have contenteditable div i want only raw text instead of HTML content while copy paste from any website. I got some solution and tried out the following $('[contenteditable]').on('paste',function(e) { e.preventDefault(); var text =…
Prem
  • 49
  • 3
1
vote
1 answer

Pseudo element takes up space in IE9

I have a div that I want to behave like an text input field. Here's the full source code example: HTML:
CSS: div:empty:before { content: 'Type here...'; color: #ccc; } div{ padding: 4px; border:…
user3621156
  • 65
  • 1
  • 7
1
vote
3 answers

Javascript functions return lines of function code or "{[native code]}," what am I doing wrong?

I am writing some code to find the user selection in a contenteditable div, I'm taking my code from this quirksmode article. function findSelection(){ var userSelection; if (window.getSelection) {userSelection = window.getSelection;} else if…
DavidR
  • 5,350
  • 6
  • 30
  • 36
1
vote
1 answer

Get content in div to PHP variable

I'm using a div with contenteditable="true" as an input field, and now I'm looking for a way to pass the content of the div to a PHP variable in order to be able to save it in a .txt file. I've been looking around for solutions, and the only…
Lenny
  • 446
  • 5
  • 21
1
vote
3 answers

Is it safe (cross-browser) to omit the value of the contenteditable attribute?

According to W3C spec... The contenteditable attribute is an enumerated attribute whose keywords are the empty string, true, and false. The empty string and the true keyword map to the true state. All of the examples and documentation I've found…
JoshR
  • 461
  • 3
  • 9
1
vote
0 answers

Arabic words coloring not working in Chrome

Arabic words coloring not working in Chrome and its perfectly working in Firefox. Below is my sentence in arabic بِسْمِ ٱللهِ ٱلرَّحْمٰنِ ٱلرَّحِيمِ And I am storing that sentence in database MySql - MyISAM - utf8_unicode_ci with CkEditor 4 Now,…
Rafee
  • 3,975
  • 8
  • 58
  • 88
1
vote
1 answer

Selection over editable DIVs

I'm creating a page with some content editable divs, and I want to select content from multiple divs. It should ignore content between divs. In my example bellow, I create some divs with headers, the headers should be ignored in the…
Victor
  • 8,309
  • 14
  • 80
  • 129
1
vote
2 answers

best method to prevent script injection in content-editable div

I am working on a project wherein I am using content-editable div, and a library, medium.js But this doesnt prevent script injection. What would be the best way to prevent injection of any kind of script into my div?
ShivangiBilora
  • 2,912
  • 4
  • 20
  • 27
1
vote
2 answers

HTML 5 toggling the contenteditable attribute with javascript

enter code hereI am trying to make something editable online with a function like this function toggle_editable (div, cssclass) { var classToEdit = document.getElementsByClassName(cssclass) for (i = 0;classToEdit.length; i++) { if…
1
vote
2 answers

No scrollbar shown when element is bigger than its flexbox container

Flexbox can be used to vertically align elements. But when a vertically-aligned element later grows, it can escape the bounds of its flexbox container. This happens even when overflow:auto is used on the element. Here's a demo with some expected and…
John Karahalis
  • 3,369
  • 2
  • 15
  • 20