How do I output the contents of the input without duplicating?

Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
Hi all.

I trace event input "input keyup", for that would lead immediately to the screen to filter blocks data which the user entered. But when I try to bring a definitive version of what the user entered (using a click), I'm going through duplication.


$('#searchPermitted').on('input keyup', function (e) { //... addLiBlocked(); }

Trading on the screen:

addLiBlocked function() { $('.select_lists-choose-blocked').click(function () { $('#select_left ul') .append(''+ $('#searchPermitted').val() + ''); }) }

by | 12 views

1 Answer

0 like 0 dislike
The standard approach is to use a timer between clicks.

var timeBetweenTypes = 700, // time between clicks 700мс myTimer; // timer //start the timer while firing keyup $('#searchPermitted').on('input keyup', function(){ clearTimeout(myTimer); if ($('#searchPermitted').val()) { myTimer = setTimeout(typeEnd, timeBetweenTypes); } }); // believe that entering text in input over function typeEnd () { $('#textAppender') .append(''+ $('#searchPermitted').val() + ''); }


Related questions

110,608 questions
257,187 answers
40,796 users