Hey all,
I've been having trouble getting the value from a WYSIWYG editor passed to my ajax controller, and I'm wondering if I'm doing something wrong. The WYSIWYG I'm using is uEditor (http://www.upian.com/upiansource/ueditor/en), and since I couldn't seem to directly get the value, I decided to use jQuery to search and find the value,
var getIframe = ($('.uEditorIframe').contents().find('#iframebody').html());
which is working. I thought the original problem was that there were new lines in the html that was returned, so I have parsed the value like so:
getIframe = getIframe.replace(/\n/g,' ');
getIframe = getIframe.replace(/\s/g,' ').replace(/ ,/g,' ');
When I alert getIframe after this, I have one line of html code. Next, I put the value into the original textarea which was converted to the WYSIWYG by doing this:
$("#longDesc").val(getIframe);
This for some reason seems not to work, as it is not showing up in my post data. Does anyone have any tips that could help me retrieve this value? Also, for bonus points, I need to be able to toggle a view between the WYSIWYG view and the source code. However, the documentation for this doesn't really provide a good way to reference the WYSIWYG once it has been created. Please help!!!