Posted on 2014-08-23
Last Modified: 2014-08-25
Hi guys ,

I'm in a middle of webapp implementation one of my pages is providing for users to fill up quote, in this page I wrote some  javascript function in order to calculate the full quote and the sub total.

The issue is that the javascript code is not really functioning.

Here is my part of my code and I attached also some page view of my application.

                        <th valign="top">Dim's: </th>
                            @Html.TextBoxFor(m => m.Dims, new { @class = "inp-form-add ", @maxlength = 200 })
                        <th valign="top">Area: </th>
                            @Html.TextBoxFor(m => m.Area, new { @class = "inp-form-add", @maxlength = 200 })
                        <th valign="top">Discount Unit: </th>
                            @Html.TextBoxFor(m => m.DiscUnit, new { @class = "inp-form-add", @maxlength = 200 })


                        <th valign="top">Disc%: </th>
                            @Html.TextBoxFor(m => m.DiscP, new { @class = "inp-form-add",@onkeyup = "Calsum", @maxlength = 200 })

                        <th valign="top">Price-unit:</th>

                            @Html.TextBoxFor(m => m.Price, new { @class = "inp-form-add", @onkeypress = "return isNumberKey(event)", @onkeyup = "checkDec(this)", @maxlength = 12 })
                        <th valign="top">Total-Price: </th>
                            @Html.TextBoxFor(m => m.Total_Price, new { @class = "inp-form-add",@onchange = "Calsum", @maxlength = 200 })

Open in new window

<script type="text/javascript">
 function Calsum() {
            var untd = $('#DiscUnit').val();
            var pric = $('#Price').val();
            $('#Total_Price').val(untd * pric);


Open in new window

Thanks ,
Question by:Moti Mashiah
    LVL 74

    Accepted Solution

    Change the attribute to:

    @onkeyup = "Calsum();"

    Open in new window

    You need to actually execute the function, not point to it.
    LVL 1

    Author Closing Comment

    by:Moti Mashiah
    Thank you very much excellent solution.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now