0
votes

I want to apply the ckeditor inline editing to all elements with a specific attribute.

The problem is that its only applying to the very first element with the attribute, and not the rest.

How can i apply the ckeditor inline text editing to all elements with a specific attribute?

 $(".edit-element").ckeditor();

PS: im using ckeditor on elements that have contenteditable="true" and not textareas.

2

2 Answers

2
votes

How about converting it to use .each? You can then also check the amount of elements you are targeting very easily (see comment);

$(".edit-element").each(function() {
    // Log element with something like console.log(this);
    $(this).ckeditor();
});
0
votes

I tried this the first time and it didnt work. this time i noticed it was sending out this error

 Uncaught Error: The specified element mode is not supported on element: "a". 

and so I enabled the editor to work on "a" tags and span by adding this

 CKEDITOR.dtd.$editable.span = 1
 CKEDITOR.dtd.$editable.a = 1