jQuery – Desativando os botões do mouse e o Ctrl+V

function somenteNumeros(campo) {

    var digits = "0123456789";
    var campo_temp;

    for ( var i = 0; i < campo.value.length; i++) {
        campo_temp = campo.value.substring(i, i + 1);
        if (digits.indexOf(campo_temp) == -1) {
            campo.value = campo.value.substring(0, i);
        }
    }
}

jQuery(document).ready(function() {  
    
    function disableRightClick(){
        document.oncontextmenu = function() { return false; };
    }

    function enableRightClick(){
        document.oncontextmenu = function() { return true; };
    }
    
    jQuery("#idMatriculaCadastro , #idMatriculaFiltro").live(
            "focus", function(){ disableRightClick(); } );  
    
    jQuery("#idMatriculaCadastro, #idMatriculaFiltro").live(
            "blur", function(){ enableRightClick(); } ); 
});

Share and Enjoy !

0Shares
0 0