<input type="text" id="Keyword" />
document.onkeydown = function (event) {
var Keyword= $('#Keyword').val();
if (event.key == "Backspace" && Keyword.charAt(Keyword.length - 1) == "]") {
var name = Keyword.substring(Keyword.lastIndexOf("["));
console.log(name)
console.log(event, Keyword);
$('#Keyword').val(Keyword.substring(0, Keyword.lastIndexOf(name)+1))
}
// console.log(event);
}
JS监听删除按键Backspace,判断标签全部删除
最新推荐文章于 2023-10-06 17:29:30 发布
关键词由CSDN通过智能技术生成