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

  • Home
  • SEARCH
  • 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 8850819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:59:19+00:00 2026-06-14T12:59:19+00:00

I have a simple conversion form from kg to lbs. html <input type=text id=kg

  • 0

I have a simple conversion form from kg to lbs.

html

<input type="text" id="kg" name="kg">
<input type="text" id="lbs" name="lbs">

I have it setup so that the lbs box updates while you type in the kg box with this code.

jQuery

$("#kg").keyup(function(){
    $('#lbs').val($('#kg').val()*2.20462);
});

How do I get the lbs value to round to 2 decimals places? I am sure it is something fairly simple but all the examples I found online are for if the number is stored in a variable.

  • 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-14T12:59:20+00:00Added an answer on June 14, 2026 at 12:59 pm

    use toFixed:

    $('#lbs').val(($('#kg').val()*2.20462).toFixed(2));
    

    number.toFixed( [digits] )
    

    Parameter

    digits The number of digits to appear after the decimal point; this
    may be a value between 0 and 20, inclusive, and implementations may
    optionally support a larger range of values. If this argument is
    omitted, it is treated as 0.

    Returns

    A string representation of number that does not use exponential
    notation and has exactly digits digits after the decimal place. The
    number is rounded if necessary, and the fractional part is padded with
    zeros if necessary so that it has the specified length. If number is
    greater than 1e+21, this method simply calls Number.toString() and
    returns a string in exponential notation.

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

Sidebar

Related Questions

I have simple php validation form that is halfway working. If you leave the
I have a simple regex conversion method that I use to do some minor
I have an html/jsp form that I am serializing(using jquery) and passing to a
I have simple win service, that executes few tasks periodically. How should I pass
I have a simple ASP.NET web form as below: <form id=form1 runat=server> <asp:TextBox ID=txt
I have a simple referrers table with three columns: Referrer //string name of partner
I have a web app with a form that I am trying to pass
I want to utilise some form of simple encryption that is reasonably secure but
I have a simple javascript function to validate a form (RSform!Pro in Joomla) on
I have a dynamic form that is generated based on javascript. Here's the relevant

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.