JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.0/jquery.validate.min.js"></script>
<form id="my-form" name="my-form" method="post">
<input type="text" name="myText">
<p></p>
<input type="radio" id="my-radio-1" name="myRadio">
<label for="my-radio-1">selection #1</label>
<input type="radio" id="my-radio-2" name="myRadio">
<label for="my-radio-2">selection #2</label>
<p></p>
<p>
<input type="submit" id="my-submit">
</p>
</form>
CSS
/* Custom style */
/* remove standard-styles */
input, select, textarea {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border: none;
border-radius: 0;
}
/* Input & Textarea */
input, textarea {
background-color: white;
border: 1px solid #bbb;
padding: 5px;
box-shadow: inset 0 2px 1px 0 rgba(0, 0, 0, 0.2);
}
textarea {
resize: vertical;
}
/*
input:hover,
input:active,
textarea:hover,
textarea:active {
border: 1px solid #666;
}
*/
/* Select */
select {
border: 1px solid #bbb;
padding: 5px 40px 5px 5px;
box-shadow: 0 2px 1px 0 rgba(0, 0, 0, 0.2);
background-color: white;
background-image: url('../img/select-arrow.png');
background-position: right;
background-repeat: no-repeat;
width: auto;
min-width: 90px;
}
select:hover {
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
}
/* Hide browser-styling in IE10 */
select::-ms-expand {
display: none;
}
/* Hide custom-icons in lower versions of Internet Explorer (< IE10). */
.lt-ie10 select {
background-image: none;
}
/* graceful degradation for ie8 */
input[type='checkbox'],
input[type='radio'] {
width: auto;
float: left;
margin-right: .75em;
background: transparent;
border: none;
}
/* better styling only for modern browsers. To identify them, check for pseudoclass (:checked, :not(checked)) */
/* hide standard inputs */
input[type='checkbox']:checked,
input[type='checkbox']:not(checked),
input[type='radio']:checked,
input[type='radio']:not(checked) {
background: transparent;
position: relative;
visibility: hidden;
margin: 0;
padding: 0;
}
input[type='checkbox'] + label,
input[type='radio'] + label {
cursor: pointer;
}
/* add custom inputs with ::before */
input[type='checkbox']:checked + label::before,
input[type='checkbox']:not(checked) + label::before,
input[type='radio']:checked + label::before,
input[type='radio']:not(checked) + label::before {
content:...
JavaScript
$('#my-form').validate({
// specify rules
rules: {
myText: {
required: true
},
myRadio: {
required: true
}
},
// change name of error class that is assigned to input fields
errorClass: 'error_validate',
errorPlacement: function (label, element) {
// default
label.insertAfter(element);
}
})
;