0

adding content to div in d3 js

gv_html='<span style="margin: 2px;background-color:#ffffff ;position:relative;height: 30px ">      <input ?onkeyup=search() id="setext" style="height:27px " type="text" >   <img  style="position: ?absolute;right:2px ;padding-top:3px " id="myI" src="search.jpg" > </span>'  

i want to add this content to

d3.select('body').append('div').add 

above content in that div is this possible,help me

Roope Hakulinen
  • 7,326
  • 4
  • 43
  • 66
Karela Sahiti
  • 89
  • 1
  • 2
  • 9

2 Answers2

0

It's good to use jQuery for this. But, this will also work http://jsfiddle.net/39rwneLL/1/

d3.select('div')
.append('span')
.style('margin', '2px')
.style('background-color', '#ffffff')
.style('position', 'relative')
.style('height', '30px');
d3.select('span')
.append('input')
.attr('id', 'setext')
.attr('attr', 'text')
.style('height', '27px');
d3.select('span')
.append('img')
.attr('id', 'myI')
.attr('src','http://upload.wikimedia.org/wikipedia/en/8/89/Construction_Icon_small.png')
.style('height', '20px')
.style('position', 'absolute')
.style('right', '2px')
.style('padding-top', '3px');
Aakash
  • 1,751
  • 1
  • 14
  • 21
  • its woring for html div tag but i want to add this element in svg which is not working d3.select('svg').append('div').add – Karela Sahiti Dec 19 '14 at 10:14
  • You can find your anser here http://stackoverflow.com/questions/17595813/is-it-possible-to-append-a-div-inside-svg-element – Aakash Dec 19 '14 at 10:17
0

This is solution to find this by click

d3.select('#set1').append("input").attr("id","setText").attr("type","text").style("height","27px").on("keyup",search);

click

RamRajVasavi
  • 896
  • 4
  • 12
  • 28