Get Rich Text Box Text with JavaScript in SharePoint

Functions to get Text Value from RTE (Rich Text Box) in SharePoint

<script>
function GetRTEText()
{
var _body = getTagFromIdentifierAndTitle(“input”,”TextField”,”Body”);
var _body = RTE_GetEditorDocument(_body.id);
var _bodyText = _body.body.innerText;
alert(_bodyText); //-> Value
return true;
}

function getTagFromIdentifierAndTitle(tagName, identifier, title)
{
var len = identifier.length;
var tags = document.getElementsByTagName(tagName);
for (var i=0; i < tags.length; i++)
{
var tempString = tags[i].id;
if (tags[i].title == title && (identifier == “” || tempString.indexOf(identifier) == tempString.length – len)) {
return tags[i];
}
}
return null;
}
</script>

1 comments:

caesarkollete said...

Get started with RichTextBox control

Post a Comment

Popular Posts