You are not logged in.

#1 2006-12-22 15:58:42

diederickh
Member
Registered: 2006-03-12
Posts: 9

Changing href from code

Hi all,

I've been struggling with a piece of code which changes the href of a selected <a> element.
You must set the attribute mce_href as well if you want to change the href.

here is my code with:
this.moAnchor is the <a> element to update
this.moMCE is the editor instance

<code>
this.moAnchor.setAttribute('href', '#');
this.moAnchor.setAttribute('class', 'load_category_content');
this.moAnchor.setAttribute('mce_href', s_new_url);
this.moAnchor.setAttribute('href', s_new_url);
this.moMCE.repaint();
</code>

Greetings Roxlu

Offline

 

#2 2007-01-27 22:02:18

kvdnberg
Member
Registered: 2006-09-11
Posts: 8

Re: Changing href from code

Thank you Thank you Thank you Thank you!!!

I've been at this for hours and I couldn't figure it out, I used the anchor code as a base for a simple upload and the href just wouldn't stick, it would show the change if you opened the dialog again but not in html or after save, but it did change properly if you just inserted that link. It drove me nuts. And now it works! I would never have figured this out by myself.

Thank you so much! big_smile

Last edited by kvdnberg (2007-01-27 22:04:50)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2008 PunBB