如何防止用户使用 vanilla javascript 在文本输入中输入 0 作为第一个字符?

how can I prevent a user to type 0 as the first character in a text input using vanilla javascript?

我有这个 html 块:

<div class="form-group flex-auto" >
                <input maxlength="2" class="form-control format__itemForm" type="text" ng-model="$ctrl.codigoPaisTelefono"   prevent-keys="{{ $ctrl.caracteresExcluidos }}"
                required oninput="this.value== 0? this.value == '' :void(0)"
                > 
            </div>

我需要防止用户输入 0 作为第一个字符,我尝试了上面的 oninput 方法,但没有用。

有线索吗?

也许是这样的?

function validate(element){
  var val = element.value;
  if(val.charAt(0)=='0'){
    element.value=val.substring(1, val.length);
  }
}
<input oninput="validate(this)">