Tag: jwysiwyg
Reset jwysiwyg
by z3n on Jan.15, 2010, under Coding, Games and Gaming
Problem:
jquery’s extension jwysiwyg can’t be reseted on fly, calling the function again will just append another editor.
Solution:
You will need to do a workaround by adding the jwysiwyg object inside a container then resetting it using this little function:
-
function _reset_jwysiwyg(h,x,j){ // html, first id, second id
-
h=str_replace("\\","",h); // this requires php.js to work, can be removed if you don't add slashes on your vars
-
$("#cf"+x+""+j).html("<textarea id='#f"+x+""+j+"' class='jwysiwyg' name='jwysiwyg' cols=94 rows=30>"+h+"</textarea>");
-
$(".jwysiwyg").wysiwyg({
-
html: h
-
// you may want to add other control options here
-
});
-
}
this will work for this setup:
<span id=’c12′><textarea id=’f12′ class=’jwysiwyg’ name=’jwysiwyg’ cols=94 rows=30></textarea></span>
on this example it will be called as:
_reset_jwysiwyg(“”,1,2);
Note
this function is a snippet from my code, you might not want the identifiers just the div name, that makes it less complicated.