I have a jquery jhtml WYSIWYG editor in a form and I need to append its output to a textarea manually. The form is being submitted via ajax. The updateText function is called to grab whats in the wysiwyg div and place it in a textarea to enable ajax to send it. I am using the ajaxForm “beforeSubmit” callback to fire off this function.
//For Ajax Form
$('#addFaci').ajaxForm({
beforeSubmit: updateText,
success: function(response) {
eval(response);
}
});
function updateText(formData, jqForm, options){
var save = '#detail';
$(save).val($(save).htmlarea("toHtmlString"));
return true;
};
This is not working on the first submit... you have to click submit twice before updateText actually fires. Does anyone have any ideas?
Thanks,