Hi, in your code this should look like this:
$(document).ready(function() { $("#firstBox, #secondBox, #thirdBox, #forthBox").change(function cal () { $("#thirdBox").val(Math.ceil(((Number($("#forthBox").val()) * Number ($ ("#secondBox").val()) )/100 )- Number($("#firstBox").val()))); }); $("#Increase").click(function() { $("#forthBox").val(5 + Number($("#forthBox").val()) ); $("#thirdBox").val(Math.ceil(((Number($("#forthBox").val()) * Number ($ ("#secondBox").val()) )/100 )- Number($("#firstBox").val()))); }); $("#Decrease").click(function() { $("#forthBox").val( Number($("#forthBox").val()) - 5 ); $("#thirdBox").val(Math.ceil(((Number($("#forthBox").val()) * Number ($ ("#secondBox").val()) )/100 )- Number($("#firstBox").val()))); }); but if it doesn't work show us your html... On 15 Lis, 18:51, waseem sabjee <waseemsab...@gmail.com> wrote: > May i see your html > > On Sun, Nov 15, 2009 at 7:24 PM, factoringcompare.com < > > > > firstfacto...@googlemail.com> wrote: > > Thanks. this does not work. Added class to form and included the > > above. > > > On Nov 15, 5:05 pm, waseem sabjee <waseemsab...@gmail.com> wrote: > > > say you have 5 text boxes each with the class mybox > > > > var x = $(".mybox").length; > > > > var y = Math.Round(x); > > > > OR > > > > var y = Math.Ceil(x); > > > > On Sun, Nov 15, 2009 at 6:45 PM, factoringcompare.com < > > > > firstfacto...@googlemail.com> wrote: > > > > Hi, > > > > > Great, I have a a go at putting into my code but can't can you suggest > > > > how? > > > > > On Nov 15, 4:06 pm, PiotrJaniak <janiak.piot...@gmail.com> wrote: > > > > > Hi, > > > > > > to round up results u can use Math.ceil(value); > > > > > > On 15 Lis, 16:10, "factoringcompare.com" > > > > > > <firstfacto...@googlemail.com> wrote: > > > > > > Hi, > > > > > > > The below calculates a couple of textboxes and then allows for the > > > > > > user to click an up or down image to re calculate decreasing or > > > > > > increasing a number. Question is how can I round up the result to > > no > > > > > > decimal places? > > > > > > > And ….. . any suggestions on how to improve the code would be good. > > > > > > > $(document).ready(function() { > > > > > > > $("#firstBox, #secondBox, #thirdBox, #forthBox").change(function > > cal > > > > > > () { > > > > > > $("#thirdBox").val( ((Number($("#forthBox").val()) * Number($ > > > > > > ("#secondBox").val()) )/100 )- Number($("#firstBox").val())); > > > > > > > }); > > > > > > > $("#Increase").click(function() { > > > > > > $("#forthBox").val(5 + Number($("#forthBox").val()) ); > > > > > > $("#thirdBox").val( ((Number($("#forthBox").val()) * Number($ > > > > > > ("#secondBox").val()) )/100 )- Number($("#firstBox").val())); > > > > > > }); > > > > > > > $("#Decrease").click(function() { > > > > > > $("#forthBox").val( Number($("#forthBox").val()) - 5 ); > > > > > > $("#thirdBox").val( ((Number($("#forthBox").val()) * Number($ > > > > > > ("#secondBox").val()) )/100 )- Number($("#firstBox").val())); > > > > > > }); > > > > > > > });- Hide quoted text - > > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text -