I am having problems with my inputs having to accept only numbers like integers only and float, the problem is when everytime I input a value like "50.50", only "50.5" will be saved into the database, and when I input 500.50, "500.5" will be saved to the database, and if I input "50.0050" what will be saved to the database is "50.005". how can I make the input fields with this class save "50.50" if I input 50.50 or "50.75" if input 50.75 and so on? and if there is a way that zero "0" and other characters like letters and punctuation marks other than period "." will automatically be removed upon input?
and one more thing, could this be possibly done after the user lost focus from the input field? or after every keypress perhaps?
this is what i have so far:
<script>
$(".digitOnly").each(function() {
var .digitOnly = $.isNumeric($(this).html())
$(this).val();
else{
($(this).inputVal = "");
)
});
</script>
to those who have down-rated this post, you should have tried first your suggestion and the one I am trying to achieve as your suggested link still doesn't accept the value like "50.50".
but if you know such a result, I would greatly appreciate it than down-rating my post.
I am pertaining to this post:
How to only accept numbers like integer and float in an input field values using jQuery
this does not accept the input "50.50".