Есть код:
var $arr = ['mobile_phone','email','first_name','pcode','province','city','street','house'];
    inputvalue($arr);
    
    function inputvalue(arr){
        for (index = 0; index < arr.length; ++index) {
            value = getCookie(arr[index]);
            if(value !== null){
                alert(value);
                $(function(){
                    $('input[id='+arr[index]+']').attr('value', value);
                });
            }
        }
    }
    
    function getCookie(cookie_name){
      var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
      if(results){
        return ( unescape ( results[2] ) );
      } else {
        return null;
      }
    }
$('input[id='+arr[index]+']').attr('value', value); не работает кусок именно этот, не могу понять. Помогите пожалуйста