Demos: Autocomplete, multiple: scroll input to the right on addition

Exposes the last added item in narrow <input> containers.
This commit is contained in:
kernc 2018-06-23 19:36:28 +02:00 committed by GitHub
parent 74f8a0ac95
commit 6b956c336c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,6 +67,8 @@
// add placeholder to get the comma-and-space at the end
terms.push( "" );
this.value = terms.join( ", " );
// scroll input viewport to as far right as possible
this.selectionStart = this.selectionEnd = this.value.length;
return false;
}
});