removing of duplicated values

removing of duplicated values

I want to loop the values inside of php array and check to my html if its duplicated or not. when values is greater than to one, I want the other duplicate values to be removed.


  1. <script type="text/javascript">

  2. var jQueryArray = <?php echo json_encode($arrayForDeposit); ?>

  3. for ( var i = 0; i < jQueryArray.length; i = i + 1 ) {
  4.   var item = jQueryArray[ i ] 
  5.   var $div = $('td .forDeposit:contains(item)');

  6.   // console.log($div)
  7. if ($div.length > 1) {
  8.   $div.not(':last').remove()
  9. }
  10. }
  11. </script>