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

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,735
Latest member
HikmatRamazanov

Latest Threads

Top