Learn free online HTML5, javascript, and jquery Tutorials by Examples

Wednesday 30 July 2014

Disable cut, copy & paste using Javascript and jquery

...................in javascript....................................
<input type="text" oncopy="return false" onpaste="return false" oncut="return false" />


--------------------------------------------------------------------------
...................in jquery....................................
<input type="text" id="txt" />
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script>
    $(document).ready(function(e) {
        $('#txt').bind('cut copy paste',function(e) {
            e.preventDefault();
            alert('not allow to do this...')
        });
    });
</script>

No comments:

Post a Comment