如何为HTML元素调用触发器更改事件



我在一个html页面中有以下输入框。当我在此列上键入数字时,没有输入或tab键,值不会被更改。onkeypress已经给了整个html的通用js文件。所以我不能在这里改变。我担心它会影响其他工作的html。是否有可能调用触发器改变事件在一个循环中的所有输入文本内的表'表'从javascript的html。它会为表格下的所有输入文本创建change事件

<input type="text" class="borderless-text-sm form-control input-mini" onkeypress="return (event.charCode >= 48 &amp;&amp; event.charCode <= 57) ||event.charCode == 46 || event.charCode == 0 || event.charCode == 13|| event.charCode == 9|| event.charCode == 16" min="0" max="24" step="any" autocomplete="off" style="padding-right: 24px;">

我猜你在找onblur?

https://www.w3schools.com/jsref/event_onblur.asp

尝试将oninput="return (event.charCode >= 48 &amp;&amp; event.charCode <= 57) ||event.charCode == 46 || event.charCode == 0 || event.charCode == 13|| event.charCode == 9|| event.charCode == 16"添加到输入

最新更新