<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<div class="panel panel-default">
<div class="panel-heading">
<span class="glyphicon glyphicon-lock"></span> Consulta de Billetes</div>
<div class="panel-body">
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="validate-telefono" class="etiqueta_formulario2 col-xs-3 control-label requiredField titulo">Teléfono:</label>
<div class="input-group" data-validate="email">
<input type="text" class="form-control" name="validate-email" id="validate-email" placeholder="Teléfono" required>
<span class="input-group-addon danger" id="firstnameInvalid"><span class="glyphicon glyphicon-remove" id="firstnameInvalid2"></span></span>
</div>
</div>
<div class="form-group last">
<div class="col-md-11">
<input type="submit" class="btn btn-primary btn-sm pull-right" value="Aceptar"/>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
body {
/*background: url(http://lorempixel.com/1920/1920/city/9/) no-repeat center center fixed; */
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.panel-default {
opacity: 0.9;
margin-top:30px;
}
.form-group.last { margin-bottom:0px; }
.input-group-addon.primary {
color: rgb(255, 255, 255);
background-color: rgb(50, 118, 177);
border-color: rgb(40, 94, 142);
}
.input-group-addon.success {
color: rgb(255, 255, 255);
background-color: rgb(92, 184, 92);
border-color: rgb(76, 174, 76);
}
.input-group-addon.info {
color: rgb(255, 255, 255);
background-color: rgb(57, 179, 215);
border-color: rgb(38, 154, 188);
}
.input-group-addon.warning {
color: rgb(255, 255, 255);
background-color: rgb(240, 173, 78);
border-color: rgb(238, 162, 54);
}
.input-group-addon.danger {
color: rgb(255, 255, 255);
background-color: rgb(217, 83, 79);
border-color: rgb(212, 63, 58);
}
$(document).ready(function() {
$('.input-group input[required], .input-group textarea[required], .input-group select[required]').on('keyup change', function() {
var $form = $(this).closest('form'),
$group = $(this).closest('.input-group'),
$addon = $group.find('.input-group-addon'),
$icon = $addon.find('span'),
state = false;
if ($group.data('validate') == "email") {
state = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test($(this).val())
}
if (state) {
$addon.removeClass('danger');
$addon.addClass('success');
$icon.attr('class', 'glyphicon glyphicon-ok');
document.getElementById("firstnameInvalid").style.visibility = "visible";
document.getElementById("firstnameInvalid2").style.visibility = "visible";
}else{
$addon.removeClass('success');
$addon.addClass('danger');
$icon.attr('class', 'glyphicon glyphicon-remove');
document.getElementById("firstnameInvalid").style.visibility = "hidden";
document.getElementById("firstnameInvalid2").style.visibility = "hidden";
}
});
$('.input-group input[required]').trigger('change');
});