Combining text and control formatting with execCommand

C

colinhumber

There are two scenarios I'm having trouble with:

1) If I have a string that includes both text and controls, such as
"This is some text <BUTTON>Click me</BUTTON>", and I want to bold the
text using execCommand as well as add the appropriate formatting tags
around the button control, so it would look like this:

<STRONG>This is some text</STRONG><STRONG><BUTTON>Click
me</BUTTON></STRONG>

How would I do that? Ideally, I'd also like the "Click me" to be
formatted as well.

2) I select a button control, <BUTTON>Click me</BUTTON>, and I want to
format this using execCommand so it would add the tags around the
BUTTON tags as above, how would I do that? In this case as well I'd
like the button text to be formatted as well.

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top