好的,所以我有一个被点击的链接......一旦它被点击,我想要改变'a'属性中的img src。这是我所拥有的
HTML:
"<td>
<a href='#' class='flag' name='$files[id]' >
<img src='".$this->config->item('base_url')."/images/notflagged.png'
class='flagimg' />
</a>
</td>"
jQuery:
$(".flag").on("click", function(e){
var fileID = $(this).attr("name");
var src = '<?php echo base_url().'images/flagged.png';?>';
// This is where I am hung up, as I want to replace the current src...if I
// just use $(".flagimg") it will change all src'c with the same class
$(this).find(".flagimg").attr("src", src);
e.preventDefault();
});