Last active
November 30, 2016 19:30
-
-
Save noili/557029ed22b3a8f1285e620506d46a8e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready (function(){ | |
$(".btn-ingresar").click(function(){ | |
var login = $("#login"); | |
var password= $("#password"); | |
if (login.val() == "Usuario1" && password.val() == "Password1"){ | |
location.href = "Pages/index.html"; | |
} | |
else{ | |
window.alert('El usuario o la contraseña ingresados son incorrectos.'); | |
} | |
}); | |
$("#btn-nuevo").click(function(){ | |
var formulario = $("#user-form"); | |
var footer = $("#footer"); | |
formulario.show(); | |
footer.hide(); | |
}); | |
$("#btn-cancelar").click(function(){ | |
var formulario = $("#user-form"); | |
var footer = $("#footer"); | |
formulario.hide(); | |
footer.show(); | |
}); | |
$("#btn-guardar").click(function(e){ | |
e.preventDefault(); | |
var formulario = $("#user-form"); | |
var footer = $("#footer"); | |
var btnGuardar = $("#btn-guardar"); | |
var tabla = $("#tablaBody"); | |
if(document.forms['user-form'].checkValidity()){ | |
tabla.append("<tr><td>Mayorista</td>" | |
+ "<td>" + $("#name").val() + "</td>" | |
+ "<td>" + $("#tel").val() + "</td>" | |
+ "<td>" + $("#mail").val() + "</td>" | |
+ "<td>" + $("#date").val() + "</td></tr>"); | |
} | |
else{ | |
window.alert("no!"); | |
} | |
}); | |
$("tbody tr").click(function() { | |
$(this).addClass('selected').siblings().removeClass("selected"); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment