How to set class attribute for elements with document contenteditable

With a div contenteditable, when executing document.execCommand('insertImage', null, img_url);, it will add an image element in that div, but is there any way to add a class attribute for that image element? I don't think insertHTML is a good solution for compatibility issue.

Answers


I think you could use CSS CLass applier: http://code.google.com/p/rangy/wiki/CSSClassApplierModule


Need Your Help

Adding a new constructor to my ParentDetail class?

c#

This is a follow up to my previous question. I took the advice of a member and everything works. But now when I want to have another constructor I have a problem I didn't have before. Here's what I...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.