Mark
Mark

Reputation: 33611

wysiwyg contendeditable createRange surroundContents

I have a contenteditable div that I want users to be able to select a portion of, and then click a button to wrap a div with some class and styles around.

The div I want to wrap around:

var newNode = $('<div class=\'selectedFont\' style=\'text-align=center;\'>');

The methods I need to use are in the title, I'm looking for an example.

Thanks.

Upvotes: 0

Views: 450

Answers (1)

Tim Down
Tim Down

Reputation: 324627

My answer to this related question does what you need: apply style to range of text with javascript in uiwebview

Upvotes: 1

Related Questions