> Say, we have an input box or a textarea. There are two words selected. > I need to make them italic (<i></i>) if a button is clicked.
You want to put <i> elements inside <input type="text /> or <textarea> ? That's not possible... <input> is an empty element, and <textarea> only accepts character data..