praveen1981
asked on
comparing the textbox value with zero using javascript
Hi
I am getting the textbox value which is having "00.00" but while i am comparing i am spliting this value with '.'
and checking with "0"
var fieldValue=document.getele mentbyid(' t1').value ;
if(fieldValue.split('.')[0 ] == "0" || fieldValue.split('.')[1] == "0")
but now when the user enters more than one zero value my condition is failing is there any way to handle this
Please suggest
I am getting the textbox value which is having "00.00" but while i am comparing i am spliting this value with '.'
and checking with "0"
var fieldValue=document.getele
if(fieldValue.split('.')[0
but now when the user enters more than one zero value my condition is failing is there any way to handle this
Please suggest
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
var fieldValue = parseFloat( document.getElementById('t1').value );
if( fieldValue == 0 )
http://www.w3schools.com/jsref/jsref_parseFloat.asp
ASKER
It solved
Open in new window
http://www.w3schools.com/jsref/jsref_parseInt.asp