0

I have the following text input in a form:

<input name="imagen" type="text" id="imagen" class="form-control"  placeholder="<?php echo $lang['IMAGE_ITEM']?>" value="" readonly >

The input value is given an external script. So far so good.

Now I want to launch an action when the text changes, I am trying with this:

<script>
$( document ).ready(function() {




   $('input[id$=imagen]').bind("change", function () {
     alert($(this).val());
   });

});
</script>

But no alert and no warning at the console are thrown when the input text changes.

mvasco
  • 4,965
  • 7
  • 59
  • 120
  • Perhaps make a jsfiddle to help us debug this for you? – Liam Gray Feb 24 '17 at 20:59
  • Readonly inputs don't fire the change event when the data changes. Here is a solution that probably suits your needs. http://stackoverflow.com/questions/16013024/detect-programmatic-changes-on-input-type-text – Joel Etherton Feb 24 '17 at 21:23
  • @JoelEtherton, thank you. I will change the input type. – mvasco Feb 24 '17 at 21:24

0 Answers0