Adding editable div elements via javascript

P

Poggs

HI guys,
I had problems adding editable div elements into my page using javascript. I
was able to add the div but its content is not editable. here's my code

function addDiv(id) {

form1.appendChild(document.createElement('br'));

newDiv=document.createElement('div');

newDiv.id='div'+id;

//newDiv.isContentEditable = true;

newDiv.setAttribute('CONTENTEDITABLE','true');

newDiv.innerHTML = 'This is a test of the system';

// and modify/add any other properties you wish here

form1.appendChild(newDiv);

}



What am I doing wrong here?
 
J

Joe Fawcett

Poggs said:
HI guys,
I had problems adding editable div elements into my page using javascript.
I was able to add the div but its content is not editable. here's my code

function addDiv(id) {

form1.appendChild(document.createElement('br'));

newDiv=document.createElement('div');

newDiv.id='div'+id;

//newDiv.isContentEditable = true;

newDiv.setAttribute('CONTENTEDITABLE','true');

newDiv.innerHTML = 'This is a test of the system';

// and modify/add any other properties you wish here

form1.appendChild(newDiv);

}



What am I doing wrong here?
The propery is contentEditable, not isContentEditable.
If that still doesn't work try changing the property after appending the
div.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top