I have an input element with default value of '2':
<input type="text" class="chapter" value="2" />
Which displays as follows when using jQuery mobile:
<div class="ui-input-text ui-shadow-inset ui-corner-all ui-btn-shadow ui-body-c">
<input type="text" class="chapter ui-input-text ui-body-c" value="2">
</div>
I want to do something every time the value is changed by the user, so I say:
$('.chapter').change(function(i, el) { alert("coding is epic"); });
However, as I change the value to '5' and click off the element, nothing happens. Checking out the developer tools shows me that the value is still '2', even though '5' is displayed on the screen.
The wierd thing is that it does work on the following element:
<input id="UploadFile" type="file" name="datafile">
when called for using:
$('#UploadFile').change(function(e){ //aaaaargh! });
How can I do something when this value changes? Also, there are many elements on the page with class="chapter"
, all of type <input>
, and I have attempted using $('.chapter').each().change(function(i, el) {