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 8705431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:21:25+00:00 2026-06-13T03:21:25+00:00

I have a rather complex formula that I want to recreate with code, I

  • 0

I have a rather complex formula that I want to recreate with code, I have set up a fiddle
But I have no idea where to start with the JavaScript/jQuery?

Any help to get me started and point me in the right direction would be wonderful.

The formula I need is

(1/(1 - A %)) - 1 = B %
A = Percentage drop (#input)
B = Percentage gain (#output)

For example: If A drops with 25%, B has to increase 33% to break even

I would like the output to be displayed on click of the Calculate div, then in the future I would like to use a jQuery slider to change the input value and have the output change dynamically.

<div id="calc">
<div id="inputlabel">INPUT</div>
<input id="input">%</>
<div id="calculation">CALCULATE</div>
<h1 class="output">%</h1>
</div>​
  • 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-13T03:21:26+00:00Added an answer on June 13, 2026 at 3:21 am

    This code will work:

    $(document).ready(function() {
        $('#calculation').click(function() {
            var inp = parseFloat($('#input').val());
            var out = parseFloat((1 / (1 - (inp / 100))) - 1);
            out = parseInt(out * 100);
            $('h1.output').text(out + ' %');
        });
    });
    

    Check the updated fiddle.

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

Sidebar

Related Questions

I have a set of rather complex ORM modules that inherit from Class::DBI .
Running my (rather complex) JavaScript/jQuery application in Google's Chrome browser, it would appear that
Have a (rather complex) app that works fine on iOS 4 but fails on
I have a window that contains several rather complex views. Right now, I'm using
I have a number rather large, complex xml documents that I need to loop
I have a PHP class that stores a complex multidimensional array, and rather than
I have a legacy class that is rather complex to maintain: class OldClass {
I have a rather complex query that pretty much mimics a test query I
Following the Heroku tutorial but I have already created a rather complex Django app
I have a rather complex legacy ASP.Net application that is under continuous development, and

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.