@siken,
I tested the answer from MB themes and works correct.... only nr no letters allowed.
Maybe you have putted it in the wrong place? This is how it works in veronika
<div class="row"> <label for="phone"><?php _e('Mobile Phone', 'veronika'); ?><?php if(strpos($required_fields, 'phone') !== false) { ?><span class="req">*</span><?php } ?></label>
<div class="input-box"><input type="tel" id="sPhone" name="sPhone" value="<?php echo $prepare['s_phone']; ?>" /><i class="fa fa-phone"></i></div>
<script>
$('input[name="sPhone"]').keyup(function(e) {
if (/\D/g.test(this.value))
{
// Filter non-digits from input value.
this.value = this.value.replace(/\D/g, '');
}
});
</script>
To allow 1 symbol like i.e: +91 use following:<script>
$('input[name="sPhone"]').on("input", function(evt) {
var self = $(this);
self.val(self.val().replace(/[^0-9\+]/g, ''));
if ((evt.which != 46 || self.val().indexOf('+') != -1) && (evt.which < 48 || evt.which > 57))
{
evt.preventDefault();
}
});
</script>