Event return null value when user enter decimal on input type number

前端 未结 2 972
误落风尘
误落风尘 2021-01-28 11:16

Edit working on Firefox, only Chrome bug (and maybe others)

I try to get all event from a simple

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-28 12:01

    The closest I can get is:

    $('input[type=number]').on('input', function() {
      $(this).select();
    
      var value = window.getSelection().toString();
      window.getSelection().empty();
    
      $('#value').text(value);
    });
    
    
    
    
    Value:

    Notice that when you type something, the field loses its focus...

提交回复
热议问题