Click here to Skip to main content
15,890,690 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When i type alphabet NaN is showing.
I want to convert NaN into 0.

JavaScript
$(document).ready(function(){
    $('#shares1').keyup(function(){
        $('#result1').text($('#shares1').val() * 6000);
    });    
});


HTML
<input name="shares1" id="shares1" type="text" autofocus />
<span id="result1"></span>
Posted
Updated 18-Oct-15 2:22am
v2

1 solution

Or allow user to enter only numbers in textbox.
HTML
<input name="shares1" id="shares1" type="number" autofocus />

-KR
 
Share this answer
 
Comments
Good advice. +5
Krunal Rohit 18-Oct-15 9:17am    
Yeah !

-KR
[no name] 18-Oct-15 9:52am    
+5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900