Custom Error Placement with jQuery Validation
by fparent
HTML
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.16.0/jquery.validate.min.js"></script>
<form class="form">
<div class="form-line">
<div class="select">
<div class="select-inner">
Select a value
<select name="my_list" required>
<option value="">No Value</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
</div>
</div>
</div>
<input type="submit" valud="Validate" />
</form>
CSS
/*======================================
Selectric v1.11.1
======================================*/
.selectric-wrapper {
position: relative;
cursor: pointer;
}
.selectric-responsive {
width: 100%;
}
.selectric {
border: 1px solid #DDD;
border-radius: 0px;
background: #F8F8F8;
position: relative;
overflow: hidden;
}
.selectric .label {
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin: 0 38px 0 10px;
font-size: 12px;
line-height: 38px;
color: #444;
height: 38px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.selectric .button {
display: block;
position: absolute;
right: 0;
top: 0;
width: 38px;
height: 38px;
line-height: 38px;
background-color: #F8f8f8;
color: #BBB;
text-align: center;
font: 0/0 a;
*font: 20px/38px Lucida Sans Unicode, Arial Unicode MS, Arial;
}
.selectric .button:after {
content: " ";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
width: 0;
height: 0;
border: 4px solid transparent;
border-top-color: #BBB;
border-bottom: none;
}
.selectric-focus .selectric {
border-color: #aaaaaa;
}
.selectric-hover .selectric {
border-color: #c4c4c4;
}
.selectric-hover .selectric .button {
color: #a2a2a2;
}
.selectric-hover .selectric .button:after {
border-top-color: #a2a2a2;
}
.selectric-open {
z-index: 9999;
}
.selectric-open .selectric {
border-color: #c4c4c4;
}
.selectric-open .selectric-items {
display: block;
}
.selectric-disabled {
filter: alpha(opacity=50);
opacity: 0.5;
cursor: default;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.selectric-hide-select {
position: relative;
overflow: hidden;
width: 0;
height: 0;
}
.selectric-hide-select select {
position: absolute;
left:...
JavaScript
/*! Selectric ϟ v1.11.1 (2017-01-11) - git.io/tjl9sQ - Copyright (c) 2017 Leonardo Santos - MIT License */
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(t,s){return void 0===s&&(s="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(s),s}:e(jQuery)}(function(e){"use strict";var t=e(document),s=e(window),i="selectric",l="Input Items Open Disabled TempShow HideSelect Wrapper Focus Hover Responsive Above Scroll Group GroupLabel",n=".sl",a=["a","e","i","o","u","n","c","y"],o=[/[\xE0-\xE5]/g,/[\xE8-\xEB]/g,/[\xEC-\xEF]/g,/[\xF2-\xF6]/g,/[\xF9-\xFC]/g,/[\xF1]/g,/[\xE7]/g,/[\xFD-\xFF]/g],r=function(t,s){var i=this;i.element=t,i.$element=e(t),i.state={multiple:!!i.$element.attr("multiple"),enabled:!1,opened:!1,currValue:-1,selectedIdx:-1,highlightedIdx:-1},i.eventTriggers={open:i.open,close:i.close,destroy:i.destroy,refresh:i.refresh,init:i.init},i.init(s)};r.prototype={utils:{isMobile:function(){return/android|ip(hone|od|ad)/i.test(navigator.userAgent)},escapeRegExp:function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},replaceDiacritics:function(e){for(var t=o.length;t--;)e=e.toLowerCase().replace(o[t],a[t]);return e},format:function(e){var t=arguments;return(""+e).replace(/\{(?:(\d+)|(\w+))\}/g,function(e,s,i){return i&&t[1]?t[1][i]:t[s]})},nextEnabledItem:function(e,t){for(;e[t=(t+1)%e.length].disabled;);return t},previousEnabledItem:function(e,t){for(;e[t=(t>0?t:e.length)-1].disabled;);return t},toDash:function(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()},triggerCallback:function(t,s){var l=s.element,n=s.options["on"+t],a=[l].concat([].slice.call(arguments).slice(1));e.isFunction(n)&&n.apply(l,a),e(l).trigger(i+"-"+this.toDash(t),a)},arrayToClassname:function(t){var s=e.grep(t,function(e){return!!e});return e.trim(s.join(" "))}},init:function(t){var...