1

Can anyone help me to get this work in d3js

My html tag are as below

<div id="source1"><ul><li>Source</li></ul></div>

i want to modify the <li>Source</li> with <li>some other text</li> by removing all the UL LI tags in DIV id source1 and creating new UL LI tags in div id source1

My code is here

d3.selectAll("ul").remove()

d3.selectAll("li").remove()

var test=document.getElementbyId('source1');
var ul=document.createElement('ul');
document.body.appendChild(test);
test.appendChild(ul);
var li=document.createElement('li');
ul.appendChild(li);
li.innerHTML="some other text";
Karthick Gunasekaran
  • 2,697
  • 1
  • 15
  • 25
  • i want to replace the li text with my new text – Karthick Gunasekaran May 23 '14 at 08:25
  • First you remove UL LI and then re-create UL LI. It is better to update LI only. – Raju Padhara May 23 '14 at 08:25
  • @user3420762, i have tried to remove UL and LI Tags and get success but i can'r recreate my UL LI in
    tag
    – Karthick Gunasekaran May 23 '14 at 08:28