Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript JS如何正确替换`&;引用_Javascript_Jquery_Twitter Bootstrap 3_Bootstrap Select - Fatal编程技术网

Javascript JS如何正确替换`&;引用

Javascript JS如何正确替换`&;引用,javascript,jquery,twitter-bootstrap-3,bootstrap-select,Javascript,Jquery,Twitter Bootstrap 3,Bootstrap Select,但这不起作用 请告诉我如何正确替换引号上的“?”在字符串写入“\”之前还需要一个转义字符 如果不工作var text=text.replace(/“/g,\\”)检查其他行,因为它对我有效。这对我有效,但仅此格式除外:。替换(/“/g,\\”) <input type="text" autocomplete="off" class="Autocomlete1" name="test"> $('.Autocomlete1').typeahead({ ajax:

但这不起作用

请告诉我如何正确替换引号上的

”在字符串写入“\”之前还需要一个转义字符


如果不工作
var text=text.replace(/“/g,\\”)检查其他行,因为它对我有效。

这对我有效,但仅此格式除外:
。替换(/“/g,\\”)
<input type="text" autocomplete="off" class="Autocomlete1" name="test">

$('.Autocomlete1').typeahead({
            ajax: {
                    url: './test.php?log=test',
                    triggerLength: 1
                  },
            updater: function(item) {
                    return item;
                },
            onSelect: function(item) {

                    return item;
                }
    });
onSelect: function(item) {
  var text = item.text;
  var text = text.replace(/&quot;/g, '"');
  $('.Autocomlete1').val(text);
  return item;
}
 var text = text.replace(/&quot;/g, '\\"');