2011-06-30 142 views
0

在SharePoint博客网站上,用户通过在设置为true的contenteditable中键入div来插入新帖子。这在iPad上不起作用,因为iPad上的Safari不支持它。在div上删除contenteditable =“true”,并使用jQuery创建文本框

我可以找到div并删除属性,但是,我将如何能够插入文本?我可以使用多行文本框替换整个div吗(不知道SharePoint在考虑保存时会怎么想)?

的HTML看起来像:

<tr> 
    <td nowrap="true" valign="top" width="190px" class="ms-formlabel"> 
     <h3 class="ms-standardheader"> 
     <nobr>Body</nobr> 
     </h3> 
    </td> 
    <td valign="top" class="ms-formbody"> 
     <!-- FieldName="Body" 
      FieldInternalName="Body" 
      FieldType="SPFieldNote" 
     --> 
     <span dir="none"><div class='ms-rtestate-field ms-rtefield' style=''><div id='ctl00_m_g_cc0fae80_c5f8_428c_9d00_793718f1d202_ctl00_ctl04_ctl01_ctl00_ctl00_ctl04_ctl00_ctl00_TextField_inplacerte_label' style='display:none'>Rich text editor</div><div class=' ms-rtestate-write ms-rteflags-0' id='ctl00_m_g_cc0fae80_c5f8_428c_9d00_793718f1d202_ctl00_ctl04_ctl01_ctl00_ctl00_ctl04_ctl00_ctl00_TextField_inplacerte' style='min-height:210px' aria-labelledby='ctl00_m_g_cc0fae80_c5f8_428c_9d00_793718f1d202_ctl00_ctl04_ctl01_ctl00_ctl00_ctl04_ctl00_ctl00_TextField_inplacerte_label' contentEditable='true' ></div><div style="clear:both;"></div></div> 
      <span dir="ltr">    
       <input name="ctl00$m$g_cc0fae80_c5f8_428c_9d00_793718f1d202$ctl00$ctl04$ctl01$ctl00$ctl00$ctl04$ctl00$ctl00$TextField_spSave" type="HIDDEN" id="ctl00_m_g_cc0fae80_c5f8_428c_9d00_793718f1d202_ctl00_ctl04_ctl01_ctl00_ctl00_ctl04_ctl00_ctl00_TextField_spSave" /> 
      </span> 
     </span> 
    </td> 
</tr> 

回答

0

你可以利用你在地方的div讲的多箱,但你会在你的列表设置改变你列的字段属性,使之认为,不会改变了代码或SharePoint可能会断开与您尝试更新的列表字段的连接。

如果必须使用SharePoint的控制,你也可以隐藏DIV:style="display:none" ,从一个普通的textarea,你可以把从SP设计师在页面上使用jQuery填充它 - 可以得到.text().html()或其.val() (无法记住我的头顶是哪一个),将其分配给var textAreaText,然后使用

$('id$=inplacerte').html(textAreaText);