<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);
});
<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值