live()不使用更改功能 [英] live() not working with change function

查看:125
本文介绍了live()不使用更改功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友关注我的代码

SCRIPT

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

HTML

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

我是jQuery的新手我想在更改时获取输入的值
该值是动态的一次又一次地改变

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

请帮助我们

推荐答案


从jQuery 1.7开始,不推荐使用.live()方法。

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

你应该使用 on()

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

这篇关于live()不使用更改功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆