循环中点击单个事件(巧用this,指向当前对象)

<em id='show' value="<?php echo $member['phone']; ?>" class="sui"><a href="#">查看归属地</a></em>
<em id='show' value="<?php echo $member['phone']; ?>" class="sui"><a href="#">查看归属地</a></em>
<em id='show' value="<?php echo $member['phone']; ?>" class="sui"><a href="#">查看归属地</a></em>
<em id='show' value="<?php echo $member['phone']; ?>" class="sui"><a href="#">查看归属地</a></em>
<em id='show' value="<?php echo $member['phone']; ?>" class="sui"><a href="#">查看归属地</a></em>
<em id='show' value="<?php echo $member['phone']; ?>" class="sui"><a href="#">查看归属地</a></em>

Jquery:

//也可以用类 $(".sui").bind('click', function(event)
$("em").bind('click', function(event) {
build = $(this);
var phone = $(this).attr("value");
$.ajax({
url: "<?php echo SITE_ADMIN_URL . '/member/get_phone/'; ?>"+phone,
type: 'Get',
dataType: '',
success:function(result){
build.html("<em>"+result+"<em>");
}
});
});
上一篇:找出A字符串中出现B字符串的起始位置


下一篇:H264 Decoder