polachan paily
polachan paily

Reputation: 69

how can call trigger changed event for the html element

I have the following input box in one html page. When I type the number on this column the value is not being changed without enter or tab key. The onkeypress has been given common js file for entire html. So I cannot change there . I scare it will affect other working html. Is it possible to call trigger change event in a loop for all input text inside a table 'table' from javascript of that html. So it will make the change event for all the input text under that table

<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;">

Upvotes: 2

Views: 77

Answers (2)

Green
Green

Reputation: 544

Try adding 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" to the input.

Upvotes: 0

Kenneth Cheung
Kenneth Cheung

Reputation: 63

I guess you are looking for onblur?

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

Upvotes: 2

Related Questions