Click buttons with out losing text focus

does anyone know how I can set up my buttons so that when I click on them I don’t lose the selected text in my input text box? Basicly, I have a text input area, and I select half the text in that input area, and then I click a button. How do I keep that text selected?