parseInt convertion 1,000.00 gives 1 but i want 1000 , what is the problem?
<html>
<body>
<script type="text/javascript">
alert(parseInt("1,000.00")) ; // always gives output 1
</script>
</body>
</html>
thank you
parseInt convertion 1,000.00 gives 1 but i want 1000 , what is the problem?
<html>
<body>
<script type="text/javascript">
alert(parseInt("1,000.00")) ; // always gives output 1
</script>
</body>
</html>
thank you
How about this?
parseInt("1,000.00".replace(/\,/g,''), 10)
If you want to preserve the decimal then,
parseFloat("1,000.00".replace(/\,/g,''), 10)
Remove the comma first and execute the parseInt
. Try this:
parseInt("1,000.00".replace(",",""));