---
title: ".change event not work as dynamic as expected"  
description: ".change event not work as dynamic as expected"  
author: "Anonymous User"  
published: 2014-11-23  
updated: 2014-11-24  
canonical: https://www.mindstick.com/forum/12679/change-event-not-work-as-dynamic-as-expected  
category: "jquery"  
tags: ["javascript"]  
reading_time: 1 minute  

---

# .change event not work as dynamic as expected

I'm new to [javascript](https://www.mindstick.com/articles/874/how-to-create-watermark-text-for-textbox-by-using-javascript), I'm using jquery, this is my [html](https://www.mindstick.com/articles/1530/design-a-simple-stylish-calculator-using-html-css-and-javascript) with php [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii):

```
<form action="" method="POST" enctype="multipart/form-data">    <h1>Quantity 1</h1>    <input id="btn1" type="number" name="cantpag" value="<?php echo $cp; ?>">     <h1>Quantity 2</h1>    <input id="btn2" type="number" name="cantreinv" value="<?php echo $cr; ?>">     <input type="submit"></form>
```

**Here is my JS:**

```
<script>$(document).ready(function(){    $(document).on('change','#btn1',function(){        alert('works');    });});</script>
```

When I change the [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) of "#btn1", nothing happens immediately, instead, I [must](https://www.mindstick.com/articles/12978/top-reasons-why-every-magento-ecommerce-store-must-opt-for-mobile-app) press tab or somwhere else to have the [alert](https://answers.mindstick.com/qa/30927/what-is-an-alert) show up. Is there any way for this to be [instant](https://www.mindstick.com/articles/65168/why-instant-loan-apps-are-the-next-big-thing-in-personal-finance), as in, just adding or removing a number from the [input](https://www.mindstick.com/forum/159209/how-can-i-read-convert-an-input-stream-into-a-string-in-java) [field](https://www.mindstick.com/forum/160867/does-mindstick-provide-training-for-field-marketing) [triggers](https://www.mindstick.com/articles/337000/what-are-sql-triggers-and-ways-of-using-them-effectively) the alert?

## Replies

### Reply by Anonymous User

```
$(document).ready(function(){        $(document).on('input','#btn1',function(){            alert('works');        });    });<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><form action="" method="POST" enctype="multipart/form-data">    <h1>Quantity 1</h1>    <input id="btn1" type="number" name="cantpag"
value="<?php echo $cp; ?>">     <h1>Quantity 2</h1>    <input id="btn2" type="number" name="cantreinv"
value="<?php echo $cr; ?>">     <input type="submit"></form>
```


---

Original Source: https://www.mindstick.com/forum/12679/change-event-not-work-as-dynamic-as-expected

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
