[jQuery] Re: Simple calculation

2009-07-30 Thread Ricardo
Adding a '+' sign makes it a number (or NaN): $('#b19').val(+b18 + (+b16*12) + +b15); You should add either + or parseInt in your variable declarations at the beginning of your script. On Jul 30, 4:40 pm, kalyan Chatterjee wrote: > Hi so in this case how to write this? > > $('#b19').val(b18 +

[jQuery] Re: Simple calculation

2009-07-30 Thread waseem sabjee
YEs, as james said. var myint = parseInt(mystring); On Thu, Jul 30, 2009 at 9:23 PM, waseem sabjee wrote: > 1. Do things in brackets first > 2. Powers and Square Roots > 3. division and multiplication > 4. Addition and subtraction > > remember left to right. > > > On Thu, Jul 30, 2009 at 9:21 PM

[jQuery] Re: Simple calculation

2009-07-30 Thread kalyan Chatterjee
Hi so in this case how to write this? $('#b19').val(b18 + (b16*12) + b15); Please tell me I am got stuck with this :( On Jul 31, 12:23 am, James wrote: > Make sure to typecast your data from Strings to Integers/Floats before > you do calculations on them. Otherwise, 1+1 may equal 11. > Use the

[jQuery] Re: Simple calculation

2009-07-30 Thread kalyan Chatterjee
Hi, Please tell me how to write this. $('#b19').val(b18 + (b16*12) + b15); Thanks in advance On Jul 31, 12:25 am, waseem sabjee wrote: > if you see something like > 1 + 1 > > make it say > (1 + 1) > instead > > On Thu, Jul 30, 2009 at 9:24 PM, waseem sabjee wrote: > > > YEs, as james said. >

[jQuery] Re: Simple calculation

2009-07-30 Thread waseem sabjee
if you see something like 1 + 1 make it say (1 + 1) instead On Thu, Jul 30, 2009 at 9:24 PM, waseem sabjee wrote: > YEs, as james said. > > var myint = parseInt(mystring); > > > On Thu, Jul 30, 2009 at 9:23 PM, waseem sabjee wrote: > >> 1. Do things in brackets first >> 2. Powers and Square Root

[jQuery] Re: Simple calculation

2009-07-30 Thread waseem sabjee
1. Do things in brackets first 2. Powers and Square Roots 3. division and multiplication 4. Addition and subtraction remember left to right. On Thu, Jul 30, 2009 at 9:21 PM, kalyan Chatterjee wrote: > > Hi I dont know can you please tell me how to it? > > Thanks > > On Jul 31, 12:20 am, waseem

[jQuery] Re: Simple calculation

2009-07-30 Thread James
Make sure to typecast your data from Strings to Integers/Floats before you do calculations on them. Otherwise, 1+1 may equal 11. Use the parseInt() or parseFloat() functions. http://www.w3schools.com/jsref/jsref_parseInt.asp http://www.w3schools.com/jsref/jsref_parseFloat.asp On Jul 30, 9:15 am,

[jQuery] Re: Simple calculation

2009-07-30 Thread kalyan Chatterjee
Hi I dont know can you please tell me how to it? Thanks On Jul 31, 12:20 am, waseem sabjee wrote: > remember the golden rule > > BODMAs > > On Thu, Jul 30, 2009 at 9:15 PM, kalyan Chatterjee > > wrote: > > > I am just trying to write this > > > $(function(){ > >        $('#submit').click(funct

[jQuery] Re: Simple calculation

2009-07-30 Thread waseem sabjee
remember the golden rule BODMAs On Thu, Jul 30, 2009 at 9:15 PM, kalyan Chatterjee wrote: > > I am just trying to write this > > $(function(){ >$('#submit').click(function(){ >var b10 = $("input[name='avgtsize']").val(); >var b11 = $("input[name='avgisold']").val(); >

[jQuery] Re: Simple calculation

2009-07-30 Thread kalyan Chatterjee
I am just trying to write this $(function(){ $('#submit').click(function(){ var b10 = $("input[name='avgtsize']").val(); var b11 = $("input[name='avgisold']").val(); var b12 = $("input[name='tfee']").val(); var b13 = $("input[name='tpm']").val(); va

[jQuery] Re: Simple calculation

2009-07-30 Thread Cesar Sanz
What?? Math science is exact... Can you provide your script? - Original Message - From: "kalyan Chatterjee" To: "jQuery (English)" Sent: Thursday, July 30, 2009 12:32 PM Subject: [jQuery] Simple calculation Hi Everyone, I am just trying to do a simple calculation - like 1440