Textbox change event in php

Textbox change event in php

Textbox change event in php

To check the textbox change in php whether it has change or not, we can you various jquery textbox change event like keyup, blur.
If you need to check on every change we can use Keyup event and if need once then you can use blur event.
Below are the textbox change event examples-

In case you need to check on every text changes-

<script>
$(function() {
var textvalue = ”;

$(‘input[type=”text”]’).on(‘focus’, function() {
textvalue = $(this).val();
});
$(‘input[type=”text”]’).on(‘keyup’, function() {
if ($(this).val() != textvalue) {
// do something
alert(‘Textvalue has been changed’);
}
});
});
</script>

In case you need to check on very last-

<script>
$(function() {
var textvalue = ”;

$(‘input[type=”text”]’).on(‘focus’, function() {
textvalue = $(this).val();
});
$(‘input[type=”text”]’).on(‘blur’, function() {
if ($(this).val() != textvalue) {
// do something
alert(‘Textvalue has been changed’);
}
});
});

</script>

Conclusion

However! This won’t detect every change, because there are lost of ways to edit textbox content that do not involve any keypress event. For example selecting a range of text then right-click-cut, or changing a word via the browser’s spell-check. Or…
Hope this will help..

Read more…

PHP Tutorial

Leave a Reply