( function ( $, rwmb, i18n ) { 'use strict'; /** * Transform an input into an autocomplete. */ function transform( e ) { var $this = $( this ), $search = $this.siblings( '.rwmb-autocomplete-search' ), $result = $this.siblings( '.rwmb-autocomplete-results' ), name = $this.attr( 'name' ); // If the function is called on cloning, then change the field name and clear all results if ( e.hasOwnProperty( 'type' ) && 'clone' == e.type ) { $result.html( '' ); } $search.removeClass( 'ui-autocomplete-input' ).autocomplete( { minLength: 0, source: $this.data( 'options' ), select: function ( event, ui ) { $result.append( '