Adding editable div elements via javascript

  • Thread starter Thread starter Poggs
  • Start date Start date
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?
 
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.
 
Back
Top