我需要为每个输入获取图像,目前我仅从输入中获取值。我还要如何为每次输入获取图像?
function calculate() {
var arr = $.map($('.checkbox:checked'), function(e, i) {
return e.id;
});
$('#span').text('Selected contacts: ' + arr.join(', '));
// console.log('the checked values are: ' + arr.join(','))
}
calculate();
$('div').on('click', 'input:checkbox', calculate);
@foreach($users as $user)
<input class="my_div checkbox" id="{{$user->username}}" name="target_id[]" type="checkbox" value="{{ $user->id }}" >
<?php $img = "thumbnail/".$user->profile_picture; ?>
@if(@getimagesize($img))
<img style="position: relative;border-radius: 50%;height: 30px;width: 30px;right: -5px;top: 4px" src="{{ url(''.$img) }}" alt="">
@endif
@endforeach
因此,每个联系人都有个人头像,在我的范围内,现在仅显示{{$user->username}}
,但我也想显示{{$user->profile_picture}}
。