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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:26:15+00:00 2026-05-13T10:26:15+00:00

HTML code: <form id=hostadd action=addmoney.php?taskid=12 method=post onSubmit=return false> <input type=hidden name=mode value= /> current

  • 0

HTML code:

<form id="hostadd" action="addmoney.php?taskid=12" method="post" onSubmit="return false">
<input type="hidden" name="mode" value="" />
current unit price:$
<input id="unitprice" name="unitprice"  type="text" size="5" maxlength="6" value= 0.50 />&nbsp
Shortfall:<input id="shortfall" type="text"  name="shortfall" size="4" maxlength="6" value=80 />
<input id="add_price" type="submit" value="Submit" onclick="Adjust()"/></form

Jquery code:

 function Adjust(){
        $totalprice=parseFloat($('unitprice').val())*parseInt($('shortfall').val());
          alert($totalprice);

        };

When I test

var unitPrice = $('#unitprice').val();
alert(unitPrice);
var shortFall = $('#shortfall').val();
alert(shortFall);

I got two blank alerts.

  • 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-05-13T10:26:16+00:00Added an answer on May 13, 2026 at 10:26 am

    You’re looking for an HTML ‘shortfall’ and ‘unitprice’:

    <shortfall></shortfall>
    <unitprice></unitprice>
    

    Do you mean to do this? Maybe your after a class or ID selctor?

    $('.unitprice').val() //class
    $('#unitprice').val() //id
    $('.shortfall').val() //class
    $('#shortfall').val() //id
    

    Try looking at each individual component to see which is failing.

    alert($('#unitprice').val());
    alert(parseFloat($('#unitprice').val()));
    alert($('#shortfall').val());
    alert(parseInt($('#shortfall').val(),10);
    

    Also, pass the radix to parseInt() (note: below I assume you are wanting decimal, so use 10)

    parseInt($('#shortfall').val(),10)
    

    Although the default is 10, its dangerous not to stipulate it. If a zero left-padded number gets passed then praseInt assumes Octal.

    alert(parseInt(010)); // alerts '8'
    alert(parseInt(010),10); // alerts '10'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My HTML code: <p>NEWS</p> <p> <form action=news.php method=post> <center><input name=NEW type=submit id=new value=NEW/> <input
My HTML code <form method=post enctype=multipart/form-data action=upload.php> <input type=file name='image' > <input type=SUBMIT value=Submit>
My HTML FORM code: <form action=upload.php method=GET enctyped=multipart/form-data> <label for=file> Filename:</label> <input type=file name=loadedFile
Please see the form HTML code below <form method=post action=register> <div class=email> Email <input
I have this HTML code to create the form: <form method=POST action=/post.php name=signup> <table>
When I click - it doesn't do anything. Html code: <fieldset> <form action=# method=post
I saw some code, html form code which looks like this: <form name=form1 method=post
Pls check code .html form gets submitted even if javascript returns false. <form id=form1
I have the following html code: <form> <table> <tbody> <tr> <td> <span>Quantity<span class=pull-right>3</span> <input
In my HTML code, I have a form tag that contains two input boxes,

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.