I have a javascript code which construct an HTML to render inside the browser, here is the javascript part i am asking about:-
if (bodyValue && bodyValue.length >= 150)
{
var displayUrl = "/Lists/Feedback/DispForm.aspx?ID="+ctx.CurrentItem.ID+"&Source=https://***/Lists/UserFeedbackSystem/AllItems.aspx"
newBodyValue = bodyValue.substring(0, 150) + "<a target='_blank' href='" + displayUrl + "'>...[Read More]</a>";
}
return "<span title='" + bodyValue + "'>" + newBodyValue + "</span>";
now if the bodyValue
contain this charecter '
then only part of the string will be shown inside the Span
title
property.
for example i have this bodyValue
:-
1. Issue started back in 3 weeks and continued recurring until last week.
2. All the resolutions suggest that the issue is with the OS rather than a scanner issue- she's the only user facing this issue.
but the title
property which will show the tool-tip will only show this part of the string (till it reaches the '
):-
1. Issue started back in 3 weeks and continued recurring until last week.
2. All the resolutions suggest that the issue is with the OS rather than a scanner issue- she
so can anyone advice how i can fix this issue? and what other characters can cause this problem?
EDIT
now i have updated my code as follow, to create a <span>
and get its outerHTML
, as follow:-
function bodyFiledTemplate1(ctx) {
var bodyValue = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
var regex = /(<([^>]+)>)/ig;
bodyValue = bodyValue.replace(regex, "");
const span = document.createElement('span');
span.title = bodyValue;
span.textContent = bodyValue.slice(0, 150);
var newBodyValue = bodyValue;
if (bodyValue && bodyValue.length >= 150)
{
var displayUrl = "/Lists/Feedback/DispForm.aspx?ID="+ctx.CurrentItem.ID+"&Source=/Lists/UserFeedbackSystem/AllItems.aspx"
const a = span.appendChild(document.createElement('a'));
a.href = displayUrl;
a.target = '_blank';
a.textContent = '...[Read More]';
}
return span.outerHTML;
but if i have the following string 7:28
inside my bodyValue
, it will be rendered as 7:28
.. i did not test other characters...