process.stdin.resume();
process.stdin.setEncoding('utf8');
$('input[name="cost"]').on('input', function() {
var num = $(this).val().replace(/[0-9]/g,(s) => String.fromCharCode(s.charCodeAt(0)-0xFEE0));
$('input[name="cost"]').val(num);
if(!$.isNumeric(num)) {
alert('数値を入力してください');
$('input[name="cost"]').val(num.replace(/\D+/g, ''));
}
})
More than 1 year has passed since last update.
【JavaScript】【Jquery】数値以外入力不可にする※全角数値はOK
Last updated at Posted at 2023-09-20
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme