Added setSelection() to change selection range and valKeepSelection() to setting element value while keeping the selection intact.