Hello everyone.
I have a button and a textarea. I want this button to add tags around the selected words in that textarea. For example the button is to add the <b> tag before the selected words and the </b> tag after the selected words. Just like these buttons, in the forms of creating a new thread,that are used to make the font of the selected words bold, italic, underlined or colored.

Recommended Answers

All 5 Replies

The execCommand([params]) could make you happy.

Troy, I recall some nasty cross-browser issues around reading/writing selected text. Does IE still have its own way of doing things or has Microsoft capitulated?

Airshow

Troy, could you please explain how to use that function?

I just want to enclose the selected text with some tags.

Hello!! Why isn't there any response??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.