JSFiddle - React, Tailwind, and code Playground

by JamesKyle

HTML

<h1>Input Error Pulse</h1>
<h2>A More Elegant Way to Say 'You're Stupid'</h2>

<div class="container">
    <form class="error-pulse">
        <input class="error-pulse">
        <label>Hey Stupid! Forget Something?</label>
    </form>
</div>

<div class="credit">The James Kyle | <a href="http://twitter.com/thejameskyle" target="_blank">Twitter</a> | <a href="https://plus.google.com/114219281805415139374/" target="_blank">Google+</a> | <a href="http://facebook.com/thejameskyle" target="_blank">Facebook</a> | Made in Boston</div>

<div class="code">
    <code>
    input.error-pulse {<br/>
        <span class="indent">
        -webkit-animation: error-pulse infinite 1.5s alternate;<br/>
        </span>
    }<br/>
    <br/>
    @-webkit-keyframes error-pulse {<br/>
        <span class="indent">
        0% {<br/>
            <span class="indent">
            border-color: auto;<br/>
            box-shadow: inset rgba(0,0,0,0.05) 0px 2px 3px, rgba(255,255,255,0.1) 0px 0px 1px, rgba(200,20,20,0.0) 0px 0px 4px;
            </span>
        }<br/>
        100% {<br/>
            <span class="indent">
            border-color: rgba(200,20,20,0.5);<br/>
            box-shadow: inset rgba(0,0,0,0.05) 0px 2px 3px, rgba(255,255,255,0.1) 0px 0px 1px, rgba(200,20,20,0.3) 0px 0px 4px, inset rgba(200,20,20,0.1) 0px 0px ;<br/>
        </span>
    }<br/>
    </span>
}<br/>
    </code>
</div>

CSS

body {
    background: #f4f4f4;
    font-family: 'Helvetica Neue', Helvetica, Arial;
    color: #252525;
}
.container {
    width: 600px;
    padding: 20px;
    margin: 20px auto;
    background: #fff;
    border-radius: 4px;
    box-shadow: rgba(0,0,0,0.15) 0px 2px 3px;
}
label {
    width: 590px;
    font-size: 20px;
    line-height: 30px;
    color: rgba(0,0,0,0.25);
    display: block;
    position: relative;
    margin-top: -40px;
    padding: 5px;
    z-index: 30;
    -webkit-transition: all 0.3s linear;
}
input {
    height: 30px;
    width: 590px;
    margin: 0px;
    margin-top: 20px;
    padding: 5px;
    font-size: 30px;
    line-height: 30px;
    outline: 0px;
    border: 1px solid rgba(0,0,0,0.25);
    border-top-width: 2px;
    background: transparent;
    border-radius: 2px;
    position: relative;
    z-index: 50;
    box-shadow: inset rgba(0,0,0,0.05) 0px 2px 3px, rgba(255,255,255,0.1) 0px 0px 1px;
    -webkit-transition: all 0.3s linear;
}
input:first-child {
    margin-top: 0px;
}
input:active, input:focus {
    border-color: rgba(0,0,0,0.5);
    background: #fff;
}
input.isthatbetter {
    background: #fff;
}

input.error-pulse {
    -webkit-animation: error-pulse infinite 1.5s alternate;
}
@-webkit-keyframes error-pulse {
    0% {
        border-color: auto;
        box-shadow: inset rgba(0,0,0,0.05) 0px 2px 3px, rgba(255,255,255,0.1) 0px 0px 1px, rgba(200,20,20,0.0) 0px 0px 4px;
    }
    100% {
        border-color: rgba(200,20,20,0.5);
        box-shadow: inset rgba(0,0,0,0.05) 0px 2px 3px, rgba(255,255,255,0.1) 0px 0px 1px, rgba(200,20,20,0.3) 0px 0px 4px, inset rgba(200,20,20,0.1) 0px 0px ;
    }
}



h1 {
    font-size: 2em;
    font-weight: bold;
    text-align: center;
}
h2 {
    font-size: 0.8em;
    color: #888;
    text-align: center;
}
.code {
    display: block;
    width: 600px;
    margin: auto;
    padding: 20px;
    background: #fff;
    border-radius: 4px;
    box-shadow: inset rgba(0,0,0,0.15) 0px 1px 3px;
    color:...

JavaScript

$('input').click(function() {
    $('input').addClass('isthatbetter').removeClass('error-pulse');
});