Block text in textBox

2
Good morning, people. I have this mask made and I need it to block text in the textBox field of my application, but I can not imagine in any way to do this. (noob) can anybody help me?

function Mascara(src, mascara) {
    try{

        var campo = src.value.length;
        var saida = mascara.substring(0, 1);
        var texto = mascara.substring(campo);
        if(texto.substring(0, 1) != saida) {
            src.value += texto.substring(0, 1);
        }
    }catch (e){
        ExibeMens ("Ocorreu exceção durante execução !" + e.description, true);
        return false;
    }
}
    
asked by anonymous 30.07.2015 / 15:44

2 answers

0
<input type="text" id="exemplo" value="Exemplo" disabled />

After you apply the mask put the inputText field to be disabled with disable with the following jQuery: $("#exemplo").attr("disabled","disabled")

I hope I have helped you!

    
30.07.2015 / 15:46
-1

If you use readonly in input text it will not allow editing, just reading as the attribute itself says.

<input type="text" readonly name="texto">

    
30.07.2015 / 16:20