6 javascript jquery twitter-bootstrap-3 bootstrap-select
<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;
}
});
Run Code Online (Sandbox Code Playgroud)
在自动input编译后我们得到nextvalue - Text " TextTextText "(数据库行有它的值)但需要输出Text " TextTextText "
对于更换"上"我希望做:
onSelect: function(item) {
var text = item.text;
var text = text.replace(/"/g, '"');
$('.Autocomlete1').val(text);
return item;
}
Run Code Online (Sandbox Code Playgroud)
但这不起作用......
请告诉我如何更换"报价?
" 在字符串中写 '\" 之前也需要一个转义字符
var text = text.replace(/"/g, '\\"');
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
33793 次 |
| 最近记录: |