Kamal Kamal - 3 months ago 12
jQuery Question

live() not working with change function

Hi friend following is my code

SCRIPT

$(document).ready(function(e) {
$('.text').live('change',function(){
var a = $(this).val();
alert(a);
})
});


HTML

<input name="" type="text" class="text"/>


I am new on jQuery i want to fetch input's value on change
The value is dynamicly change again and again

Please help me guys

Answer

As of jQuery 1.7, the .live() method is deprecated.

You should use on()

$(document).ready(function(e) {
    $('.text').on('change',function(){
        var a = $(this).val();
        alert(a);
        });
});
Comments