JqueryautoComplete給隱藏域賦值

冰點沐雪發表於2012-08-27
<script type="text/javascript">   $(function() {       function format(mail) {        
   return mail.name + " &lt;" + mail.to + "&gt";       }   
    $("#email").autocomplete(`emails.php`, {     
      multiple: true,           parse: function(data) {               return $.map(eval(data), function(row) {                   return {                       data: row,                       value: row.name,                       result: row.name + " <" + row.to + ">"                  }               });           },      
     formatItem: function(item) {               return format(item);           }    
   }).result(function(e, item) {        
   $("#content").append("<p>selected " + format(item) + "</p>");   
    });   }); 
  </script> 


相關文章