When pasting a text value containing quotes or an apostrophe using jQuery into a value
field, it is truncated at that character.
I know about single and double quotes. The text can be anything. It is saved in the database normally, everything is in order in the variable, but when outputting to html - confusion. How to avoid this error?
One of the options:
$('<div>', {
class: 'menu-block',
html: `<div class="menu-button">
<button onclick="return itemField(this)" type="button" class="btn btn-warning">
<i class="bi bi-pencil"></i>
</button>
<button onclick="return deleteField(this)" type="button" class="btn btn-danger"">
<i class="bi bi-trash"></i>
</button>
</div>
<div class="row">
<div class="col">
<input type="text" class="form-control" data="label" value='${label}' disabled />
</div>
<div class="col">
<input type="text" class="form-control" data="datal" value='${datal}' disabled />
</div>
</div>`
}).appendTo('#div-extra');