Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8616695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:41:03+00:00 2026-06-12T05:41:03+00:00

In an HTML page, I have three blocks: two textboxes and one inline SVG,

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:41:05+00:00Added an answer on June 12, 2026 at 5:41 am

    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…

    <div>
      <label for="center_x">Center X</label>
      <input type="text" data-attr="cx" id="center_x" value="200" class="attr_change" />
    </div>
    
    <div>
      <label for="center_y">Center Y</label>
      <input type="text" data-attr="cy" id="center_y" value="200" class="attr_change" />
    </div>
    
    <div>
      <label for="center_y">Radius</label>
      <input type="text" data-attr="r" id="radius" value="100" class="attr_change" />
    </div>
    
    <svg xmnls="http://www.w3.org/2000/svg">
        <circle fill="#c00" cx="200" cy="200" r="100" id="change_this" />
    </svg>
    

    The jQuery code is straightforward:

    $('.attr_change').on('keyup', function(){
      var attr = $(this).attr("data-attr");
      var value = parseInt($(this).val(), 10);
      if ($.isNumeric(value)) {
        $("#change_this").attr(attr, value);
      }
    })​
    

    http://jsfiddle.net/hzn6q/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

1) We have a page index.html with blocks: <body> <div id=action1>One</div> <div id=action2>Two</div> <div
Suppose I have an HTML page with three blocks of fixed width (their height
In my html page, I have one table, for every row there are two
I have two Drupal aggregator blocks on my page, one for a Twitter feed,
I want to show three XMLs on a single html page. These XMLs have
A very simple question. I have a html page which is divided into three
I have three forms on one page - callback, contact us and newsletter subscription.
I have 4 div's on the page with unique ID's. Example external link: www.website.com/page.html#one
I have an HTML page that for the sake of this question looks like
I have a page that loads an external HTML page into an iFrame. There

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.