Skip to content

Instantly share code, notes, and snippets.

@johnantoni
Created December 20, 2010 17:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnantoni/748714 to your computer and use it in GitHub Desktop.
Save johnantoni/748714 to your computer and use it in GitHub Desktop.
tinyMCE fix for use with jQuery.validation plugin and IE
// when using the jquery.validation plugin with a tinymce textarea you will need to write the contents of the tinymce area back into the original textarea for jquery.validation to pick up it's new value
// force tinymce content to be written back into original textarea element
var content = tinyMCE.activeEditor.getContent();
$("textarea.tinymce").val(content);
// if all else fails
tinyMCE.triggerSave();
after this you can safely apply jquery validation ala...
var validateForm = myForm.validate({
ignore: ".ignore",
errorElement: "strong"
})
@sheadawson
Copy link

I found I had to do

$("textarea.tinymce").html(content);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment