Skip to content

Instantly share code, notes, and snippets.

@edinsoncs
Created December 12, 2015 16:54
Show Gist options
  • Save edinsoncs/0a5f13fe682d16aa3e8e to your computer and use it in GitHub Desktop.
Save edinsoncs/0a5f13fe682d16aa3e8e to your computer and use it in GitHub Desktop.
Search Url Github
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Encontrar Url</title>
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
</head>
<body>
<form action="" class="form">
<fieldset class="form--Fieldset">
<input type="text">
</fieldset>
<fieldset class="form--Fieldset">
<input type="submit" value="enviar">
</fieldset>
</form>
<script>
$(".form").submit(function(e){
e.preventDefault();
var $url = $("input[type='text']").val();
if($url.length == 0) {
alert('hubo un error');
$(".form--Fieldset input[type='text']").css('border','1px solid red').after('<h1 style="color:red;">Se produjo un error</h1>').slideDown();
$("span").remove();
}
else if($url == 'http://github.com/' || $url == 'github.com') {
$("h1").remove();
$(".form--Fieldset input[type='text']").css('border','2px solid black').after('<span style="font-size:0.8em;color:blue;display:block;">Se agrego correctamente</h1>').slideDown();
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment