Canor
Canor

Reputation: 919

JQuery - How to check if input is comming from keyboard or not?

How can I check if input is coming from script or is inputed from keyboard to the textarea?

Is there an easy way to check that?

Im doing the form to send partly auto-generating messages where Im using drop-lists to genearte text and just pasting it to one textarea.

In have a function like:

        function refresh() {
            var str2 = "";

            $('input[type="checkbox"]:checked').each(function() {
                if (($('textarea', $(this).parent()).val()))
                    str2 += $('textarea', $(this).parent()).val() + " \n";
            });

            $('#Body').val(str2);

        }

Any ideas?

Upvotes: 0

Views: 128

Answers (1)

RAHUL S R
RAHUL S R

Reputation: 1579

You can use on keyup function like

$('#textAreaID').on('keyup',function(){
alert('its keyboard');
//do your stuff
})

Upvotes: 1

Related Questions