Java Script Help Needed Please

This is a script which is part of a program…
I am really a newbie as far as programming is concern especially php, java and html is concern…
Still in Learning… Would appreciate any help rendered… I just need the EditBox1 Value Returned to the field (from the calculations) to be in 2 decimal digits.
Please help me . Thanks In Advance.

Welcome!

post an example in codePen or your JS code here in the forum. Use the back tick ` or a code block!

my guess would be: https://www.w3schools.com/jsref/jsref_tofixed.asp

I amm trying to figure out how to post my javasript!!! here

Sorry Guys and Gals… I am really sorry i am unable to use this forum… I do not understand how it works…I have mistakenly ticked solved… my ignorance… if somebody can guide me please… Thank You

three BACKTICKS … not ’ or " … it’s the ~ button on PC. or click the “Preformatted Text” button in the image below
image

<script>
    
$(document).ready(function()
{
   $("#Combobox2, #Combobox3, #Combobox4").change(function()
   {
      $('#Editbox1').val($('#Combobox2').val()*2.50+$('#Combobox3').val()*4.00+$('#Combobox4').val()*6.50);
   });
   $("#Combobox2").trigger('change');
});
</script>

Thank You Sir/Madam…
Hope you can also help me with the program

I’m not very good with Jquery :slight_smile:

But what are you seeing for the EditBox1 value? Do you get a result like 20.20483802 and need it toFixed ?

I am seeing example 2 or 4.5 or 6 when what i would want is 2.00 or 4.50 or 6.00

You are really close to the end, and you already marked it as the solution :slight_smile:

toFixed(2)

https://www.w3schools.com/jsref/jsref_tofixed.asp

But sorry i do not understand how i should use it in my existing code…!!! Any help would be greatly appreciated…

$('#Editbox1').val($('#Combobox2').val()*2.50+$('#Combobox3').val()*4.00+$('#Combobox4').val()*6.50).toFixed(5)

does this result in 2.00000 ?

Sorry was testing… it gives me a blank …now. nothing in the Editbox1 field…

$('#Editbox1').val(
    (
    $('#Combobox2').val()*2.50 +
    $('#Combobox3').val()*4.00 +
    $('#Combobox4').val()*6.50
    )
    .toFixed(5)
    );

I might be missing something with JQuery, but i’m pretty sure you just need the https://www.w3schools.com/jsref/jsref_tofixed.asp in there somewhere. :thinking:

good luck!

Sorry no luck… it still gives me a blank…
Just wondering if asp and linux would make difference?

Thank You Very Much For Trying To Help…
Hope i can get it solved somehow!!

1 Like

No, something I suggested I was wrong since you were already getting a result:

I’m just not good with JQuery. You are close though!

Good luck. and someone will hopefully find my error :blush:

Happy coding!

Hi… I had solved it that night itself… but i could not thank you that night i had reached some kind of limit for the day… Thanks. It was an Extra or Missing Bracket… only. Done Mate… Thanks Again…