<div class="list-group">
<?php foreach($users as $u){?>
  <a href="#" id="<?php echo $u->cusid;?>" class="list-group-item selected_user" style="padding:5px;"><?php echo $u->firstname.' '.$u->lastname;?></a>
<?php }?>
</div>
<script>
$(document).ready(function(){
	$(".selected_user").click(function(){
		var id=$(this).attr("id");//.split("-");
		var name=$(this).html();
		$("#search_cust").val(name);
		$("#cusid").val(id);
		$(".search_result").html('');
	});
});
</script>