使用Javascript / jQuery更改Telerik RadEditor的值 [英] Changing the value of a Telerik RadEditor with Javascript/jQuery
本文介绍了使用Javascript / jQuery更改Telerik RadEditor的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用Javascript手动清理Telerik RadEditor的HTML,但我似乎无法找到存储该值的正确位置,以便在回发时保存它。
I'm trying to manually clean the HTML of a Telerik RadEditor with Javascript but I can't seem to find the correct place to store the value so that it gets saved on post back.
这是我的JS:
$(function () {
jQuery.fixHash = function ($html) {
// modify $html
return $html;
};
$("#adminEditingArea input[id$='SaveButton']").unbind("click").click(function () {
$("iframe[id$='_contentIframe']").trigger("save");
// call .net postback
return false;
});
});
var editorSaveEventInit = false;
function InitSaveEvent() {
if (!editorSaveEventInit) {
var $EditFrames = $("iframe[id$='_contentIframe']");
if ($EditFrames && $EditFrames.length > 0) {
$EditFrames.bind("save", function (e) {
var $thisFrame = $(this);
var thisFrameContents = $thisFrame.contents();
if (thisFrameContents) {
var telerikContentIFrame = thisFrameContents.get(0);
var $body = $("body", telerikContentIFrame);
var html = $.fixHash($body).html();
$body.html(html);
// also tried storing the modified HTML in the textarea, but it doesn't seem to save:
//$thisFrame.prev("textarea").html(encodeURIComponent("<body>" + html + "</body>"));
}
});
editorSaveEventInit = true;
}
}
};
$(window).load(function () {
InitSaveEvent();
});
有没有办法用JavaScript访问Telerik RadEditor对象(使用 OnClientCommandExecuted ()
?)这样我就可以访问 .get_html()
和 .set_html(value)
功能?如果没有,在发回之前我需要设置什么值?
Is there any way to access the Telerik RadEditor object with JavaScript (using OnClientCommandExecuted()
?) so that I can access the .get_html()
and .set_html(value)
functions? If not, what values do I need to set before posting back?
推荐答案
为什么不使用自定义内容过滤器。
这篇关于使用Javascript / jQuery更改Telerik RadEditor的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文