keyup event is working slow performance
问题 My example: $(document).on('keyup', '[contenteditable=true]', function (e) { let _this = $(this), text = _this.text(); if (text.length === 1) { let span = $('<span>').text(text); _this.html(span); } console.log(_this.html()); }); [contenteditable=true] { border: 1px solid #ccc; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> <div contenteditable="true"></div> My problem: If I type some text (more than 1 character) with normal speed into the div, code