jquery用$(this)的方式即可: for (var i in list) { ..... <button type="button" class="btn " onclick="like(${p.id},this)">