It needs to be displayed as in the jQuery dialog header, but it is converted to &

I need to display & as in the title bar of the jQuery dialog box, but it is converted to & . Thus, the idea is to display the value as it is in the title bar of the dialog box. It works great for everything, but when I use & or ' then it is converted to & or ' respectively. Below is my code:

 var name = '&' $('#testdialog') .dialog( { title: name, autoOpen: false, width: 900, height: 400, scrollable: true, draggable: true, modal: true, resizable: false, open: function (event, ui) { jQuery.ajaxSetup({ cache: false }); callTest(); }, close: function (event, ui) { jQuery.ajaxSetup({ cache: false }); $('#testdialog').html(''); }, buttons: { Ok: function () { $(this).dialog('close'); } } });$('#testdialog').dialog('open'); 

I want to display the value of the name variable as is. I tried to save the value in a div and used $("#divID").html() in the title attribute, but that didn't work. Could you help me with this?

+4
source share
1 answer

Update your variable to the following and you should be fine:

 var name = '&' 

For ' use:

 var name = ''' 
+2
source

Source: https://habr.com/ru/post/1440417/


All Articles