Using the setSelectionRange() method - JavaScript Tutorial

Published --