Alexander  Tolkachev Alexander Tolkachev -5 years ago 223
jQuery Question

Monitoring input field change jquery

How to detect whent i increment/decrement input value? The following code does not work for me(Using jquery 1.8)


<input type="number" id="count" value="1">

Answer Source

Use input event using .on method.

The DOM input event is fired synchronously when the value of an <input> or <textarea> element is changed.

change event on input type number/text is invoked when focus of the element is lost

Note: $("#count") is more appropriate selector(ID selector) than using Attribute Equals Selector [name=”value”] selector

$(document).ready(function() {
  $("#count").on('input', function() {
<script src=""></script>
<input type="number" id="count" value="1">

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download