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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:34:02+00:00 2026-06-10T00:34:02+00:00

jsfiddle demo Bear with me, total newb here. I’m trying to make a simple

  • 0

jsfiddle demo

Bear with me, total newb here.

I’m trying to make a simple multiplication calculator, as a experimentation with Javascript.

The catch is that –

  1. No libraries, just pure javascript.
  2. Javascript must be unobtrusive.

Now, the problem arises, that it doesn’t give the value out.

When I do this locally, answer has a value of NaN, and if you hit Submit it stays that way, BUT, if you press the back button, you see the actual result.

In the JSFiddle, much is not shown, except for the fact that it simply doesn’t work.

Please tell me, is it even possible to make an unobtrusive calculator? How?

(PS. I was taking a bit of help from sciencebuddies, just to see basic syntax and stuff, but I found it can’t be done without code being obtrusive)

  • 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-10T00:34:04+00:00Added an answer on June 10, 2026 at 12:34 am

    I realize you’re probably just getting started and don’t know what to include, remove, and whatnot. But, good advice here, clearly label your elements so you can understand them, and pare it down to the smallest possible code you need for it to work (even less, so you can build it up).

    Here is your code reworked:

    HTML

    <div>
        <input type="text" id="multiplicand" value="4">
        <input type="text" id="multiplier" value="10">
        <button type="button" id="multiply">Multiply</button>
    </div>
    <p id="result">
        The product is: <span id="product">&nbsp;</span>
    </p>
    

    Javascript

    window.onload = function(){
        var button = el('multiply'),
            multiplicand = el('multiplicand'),
            multiplier = el('multiplier'),
            product = el('product');
    
        function el(id) {
            return document.getElementById(id);
        };
    
        function multiply() {
            var x = parseFloat(multiplicand.value) || 0,
                y = parseFloat(multiplier.value) || 0;
    
            product.innerHTML = x * y;
        }
    
        button.onclick = multiply;
    };
    

    http://jsfiddle.net/userdude/EptAN/6/

    A slightly more sophisticated approach, with add/subtract/multiply/divide:

    http://jsfiddle.net/userdude/EptAN/9/

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

Sidebar

Related Questions

Im having a big headcache with a header design: Here the demo: http://jsfiddle.net/uGECm/ The
Before I explain, here's the example HTML code : [ Demo on jsFiddle here.
Please see demo here: http://jsfiddle.net/mA6qm/1/ (expand console) Why aren't events being sent or received
Please see the demo here: http://jsfiddle.net/Freewind/Vkp4U/ The html: <div class=outer> <div class=x>x</div> <div class=y>y</div>
Code in here: jsfiddle Demo I wanna to get the div#content height when it
How can i align text and image verticle align middle ?? jsfiddle demo here
Here's some code to illustrate the problem I'm running into. jsFiddle Demo <div class=normal>
I'm trying to make a simple form input field with an image INSIDE the
JsFiddle DEMO Here's my html: <span> Testing <table> <tbody> <tr> <td>One</td> <td>Two</td> <td>Three</td> </tr>
Please, Find the jsfiddle demo here . I want to take the navigation list

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.