ParseInt textbox text
I take value from textbox as,
var perOfEasyQues = parseInt(document.getElementById("<%=txb_EasyQuesPerc.ClientID%>").value);
but as I put 012 it takes 10.
Can anybody suggest solution over it?
Nitin Daphale
Junior Poster in Training
64 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
Since you are entering value with a preceding 0, the parseInt() function takes it as an octal number. Use the parseInt(, ) function instead with radix set to 10 for decimal numbers as shown below,
var perOfEasyQues = parseInt(document.getElementById("<%=txb_EasyQuesPerc.ClientID%>").value, 10);
Thanks parry_kulk for your quick reply.
Nitin Daphale
Junior Poster in Training
64 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0