I have a form where in one of the fields I ask for a person's ID. My question is, how can I make a letter in the input text that is necessary for my registration of the DNI field? I mean, I have the following code:
<div class="form-group" style="padding: 20px">
<select name="c" id="c" onchange="if(this.value!='-') cedula.value=this.value;">
<option value="-" selected="selected">Elige</option>
<option value="V"> V </option>
<option value="E"> E </option>
</select>
<label for="nombres" class="col-md-3 control-label">Cedula:<span class="asterisco">*</span> </label>
<div class="col-md-8">
<input type="text" id="ced1" name="cedula" value="<?php if(isset($cedula)) echo $cedula; ?>" />
</div>
</div>
When selecting an option of the comboBox (V, E ..) the text box is filled with that letter, but that letter can easily be deleted by hitting the keyboard key of the pc, I would like it not to be possible delete but I do not see the form.
Try applying masks to the text box as follows:
<script type="text/javascript">
jQuery(function($){
$("#numero1").mask("9,99", {
// Generamos un evento en el momento que se rellena
completed:function(){
$("#numero1").addClass("ok")
}
});
// Definimos las mascaras para cada input
// $("#date").mask("99/99/9999");
$("#movil").mask("(9999)-999-99-99");
// $("#letras").mask("aaaaaaaaaaaaaa");
$("#ced1").mask("V-9999999");
$("#ced2").mask("E-");
$("#ced3").mask("J-");
// $("#comodines").mask("?");
$("#letras1").mask('aaaaaaaaaaaaaa');
}); </script>
but it does not work for me since it is a single text box and if I apply a single mask for a single letter (The V for example) I can not place the E ... if they could help me I would appreciate it.
The letters signify the nationality of the person registering, in this case V- is for Venezuela, and E- for which he is a foreigner.