You are just changing the selected text but if nothing is selected its made not to work.