In an HTML page, I have three blocks: two textboxes and one inline SVG, say, containing a circle. Then I’d like to type the circle radius in one textbox, the circle position (comma-separated xy coordinates) in the other, then automatically (on keyup event with valid input) redraw the circle).
Of course my actual goal is not to draw a circle, but to figure out how I should assemble HTML + SVG + Javascript inside the HTML file so that things start to happen and I can build upon a working bare minimum.
jQuery would also be welcome, but not needed.
I searched a bit on Google and here (SO), but I couldn’t find any example, but I am sure this is relatively simple for the initiated.
As a bottomline, what I actually plan to do is to plot, inside the SVG element, a series of horizontal lines representing distances along a course (given inside text-area as “name;distance”, and diagonal lines from second text-area representing average speeds (horizontal axis being riding time) for a bicycle racing event. But that is my homework after I get kickstarted.
I wouldn’t recommend comma separated inputs, you’d need to do a lot of validation in order to get it right. So let’s separate the properties in three different text inputs…
The jQuery code is straightforward:
http://jsfiddle.net/hzn6q/