Navigation Menu

Skip to content

Commit

Permalink
Add function htmlEntities
Browse files Browse the repository at this point in the history
`htmlentities()` is a function which converts special characters. This allows you to show to display the string without the browser reading it as HTML.
  • Loading branch information
noobpk committed Nov 11, 2021
1 parent 3f24587 commit 2c7065e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions helpdesk/templates/helpdesk/ticket_list.html
Expand Up @@ -330,7 +330,11 @@ <h5 class="mb-0">
function get_url(row) {
return "{% url 'helpdesk:view' 1234 %}".replace(/1234/, row.id.toString());
}


function htmlEntities(str) {
return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}

$(document).ready(function () {
// Ticket DataTable Initialization
$('#ticketTable').DataTable({
Expand Down Expand Up @@ -366,7 +370,7 @@ <h5 class="mb-0">
if (type === 'display') {
data = '<div class="tickettitle"><a href="' + get_url(row) + '" >' +
row.id + '. ' +
row.title + '</a></div>';
htmlEntities(row.title) + '</a></div>';
}
return data
}
Expand Down

0 comments on commit 2c7065e

Please sign in to comment.