jquery笔记1

Posted on 2012-05-16 13:34  洪庸  阅读(68)  评论(0编辑  收藏  举报
<input type="button" value="getmd5" id="a1" />
<input type="button" value="getmd5" id="a2" />
<input type="button" value="getmd5" id="a3" />

</body>
<script>
    $('input').bind('click',function(){
        //alert(event.currentTarget.id);//a1
        //this == event.currentTarget //true
        alert(this.id);
    });


可以采用这种绑定策略,取到dom元素的id值


版权声明:本文为博主原创文章,未经博主允许不得转载。

Copyright © 2024 洪庸
Powered by .NET 8.0 on Kubernetes