changing .net textbox value problem
here is my code
$(document).ready(function () {
var val1 = $("#Content_txtYorum").val();
function checkChanges() {
var val2 = $("#Content_txtYorum").val();
console.log(val1 + " " + val2); // for test
if (val1 != val2)
alert($("#Content_txtYorum").val());
setTimeout(function ()
{
checkChanges();
}, 3000);
}
checkChanges();
});
i try to write my textChange event.. but variable val2 never changes when i write something to te开发者_高级运维xtbox. what is the problem ?
thanks..
you can just add a handler to the .change() event of your text box!
$('#Content_txtYorum').change(function(){
alert( $('#Content_txtYorum').val());
});
check out the fiddle: http://jsfiddle.net/4QHZ7/
EDIT: as per your comment, keyup should work for you:
$('#Content_txtYorum').keyup(function(){
alert( $('#Content_txtYorum').val());
});
the fiddle is updated as well http://jsfiddle.net/4QHZ7/1/
EDIT: as per your new comment, keyup should work for you:
$('.ClassOnYourDoTNetFields').keyup(function(){
alert( $(this).val());
});
EDIT: now that you've changed the question entirely... here's another answer:
check out this question of stack overflow: it gives 2 different possible solutions:
detecting changes with ckeditor
精彩评论