如何用jquery替换输入文本中的字母?

I need remove the letters A nd B from a input text with jquery:

这是我的测试:

$('.ab1').bind('keyup', function() {
  console.log($('.ab1').val().replace(/a/g, '')); 
});

$('.ab2').bind('keyup', function() {
  console.log($('.ab2').val().replace(/b/g, '')); 
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input class="ab1" type="text">
<input class="ab2" type="text">

Individualment it work but if I add console.log($('.ab1').val().replace(/ab/g, '')) it dont work.