similar question asked here: How to detect a textbox's content has changed
but here my textbox is disabled.
i want to get notified as soon as my text box changed value.
The text box value changed because of AJAX callback.
similar question asked here: How to detect a textbox's content has changed
but here my textbox is disabled.
i want to get notified as soon as my text box changed value.
The text box value changed because of AJAX callback.
First your Question is not clear..
But I assume what you want:-
So just a simple code to learn !!
HTML CODE:-
<div>
First name: <input type="text" name="fname" id="myTextBox" ><br>
<input type="button" name="submit" id="submit" value="Submit">
</div>
jQuery Code: -
$("#myTextBox").change("input", function() {
alert("changed");
$("#myTextBox").attr("disabled", "disabled");
});
$("#submit").click("input", function() {
alert("clicked");
$("#myTextBox").removeAttr("disabled", "disabled");
});
<input type="text" id="tb1" disabled />
<input type="text" id="tb2"/>
$('#tb1').change(function() {
alert('Don\'t try to be clever ');
$(this).val('').attr('disabled','disabled');
});
when the user edit the disabled textbox value after focus is out of the textbox he gets an alert message and texbox again becomes disabled and value is set to null again.
Working Demo http://jsfiddle.net/cse_tushar/m5SVH/
If you text box is being dynamically edited through code without user adding the content then...you can remove the disabled class being applied to it to get hold of the value in it and compare with your previously stored value...