设置值textarea RTE

时间:2013-11-14 20:28:39

标签: javascript jquery sharepoint-2010

我正在尝试为RTE字段设置一个值,但它不会取值。这一行: Ae2.val(Ae1); //即使这样也行不通:Ae2.val(“测试”); 任何想法。谢谢

function PreSaveAction()
{
    $(document).ready(function() {
        var  Ae2 = $("#ctl00_m_g_1b07d546_aec6_4582_b36d_9bfe97fc36e0_ff26_1_ctl00_ctl00_TextField_inplacerte");
        //SharePoint's Rich text editor
        alert("Ae2 before set val: \n" + Ae2.html());
        Ae2.val(Ae1); // even this will not work: Ae2.val("Test");
        alert("Ae2 after set val: " + Ae2.html());
    });
    return true;
}

1 个答案:

答案 0 :(得分:0)

请尝试以下

$('iframe[id^="ctl00_m_g_1b07d546_aec6_4582_b36d_9bfe97fc36e0_ff26_1_ctl00_ctl00_TextField_inplacerte"]').contents().find("body").html("Test");