Reputation: 187
I want a simple text input field for my d3.js visualization, as simple as the HTML <input>
. I'm surprised that I can't find any native svg elements for this. Is there any simpler way of achieving a text input field than a <text>
element inside a <rect>
which triggers a keylistener that updates the text
attribute of the <text>
element upon every keydown? Creating code for SHIFT, Alt, backspace, delete keys etc really seems like reinventing the wheel and I want to avoid it. Is there any way I can?
Upvotes: 2
Views: 1506
Reputation: 14053
Unless there are some other constraints which you haven't mentioned, it's perfectly possible to mix HTML and SVG in the same document. There's probably no need to reinvent a input field in SVG.
Upvotes: 3