how to use preventDefault() with paste event in jquery
<p>I have a problem, i have a validation on TextBox to prevent the user to input the data more than 10 characters, i have applied the validation on keyprees but i am not able to restrict the user to paste the data with length more than 10.
i have searched and try paste event but its not working its not restricting the user to paste the value, preventDefault(); is not working.</p>

<p>code-</p>

<pre><code>$('#EMName').bind('paste', function (e) {
        var self = $(this);
        var v = false;
        var flag = setTimeout(function () {

            var len = $(self).val().length;
            if (len &gt; 10) {
                alert("false");
                v = false;
                return false
            }
            else {
                alert("true");
                v = true;
                return true;
            }

        }, 0);
        if (v == false)
            e.preventDefault();   
});
</code></pre>
