tags:

views:

562

answers:

2

I'm trying to find a way to extend jWysiwyg. I need a function to insert this code inside the editor:

<a rel="shadowbox" href="images/photo_big.jpg" class="option" >
  <img src="images/photo_small.jpg" id="rightcontentImg" alt="photo" />
</a>

So not only the image, but also a link. I know i can use something like this to insert images:

$('#cont').wysiwyg('insertImage', 
      'http://www.google.com/images/nav_logo4.png', 
     { 'class' : 'myClass', 'className' : 'myClass' });

But it is pretty basic and i don't need much more, just the first solution, inserting raw html would also be just fine, even preffered.

Did anyone had any experiences on that?!

Tnx a lot!

A: 

I think you want...

 $('#cont').Append($('<a rel="shadowbox" (etc) </a>')).wysiwyg(....
James Curran
No, i'm trying to add content to RTE, not the div. So i have my regular bold, italic, underline, and i want to have one to insert custom HTML.
Sinisa Valentic
+1  A: 

I've just did something like this;

var cont = $('#cont');
cont.wysiwyg('setContent', cont.val() +
  '<a rel="shadowbox" href="images/photo_big.jpg" class="option" >
    <img src="images/photo_small.jpg" id="rightcontentImg" alt="photo" />
  </a>'
);
fsniper