简体   繁体   中英

Arrow in jQuery validation engine

In JQuery validation engine for the promptPositions bottomRight and bottomLeft the arrow points towards top and vice versa. for centerRight Position I want to point the arrow towards the left side, and for centerLeft I want to point the arrow towards the right.

I worked on it. But, couldn't find a better solution.

arrow.addClass("formErrorArrowBottom").html('<div class="line5"><!-- --></div>\n\
<div class="line6"><!-- --></div>\n\
<div class="line7"><!-- --></div>\n\
<div class="line8"><!-- --></div>\n\
<div class="line9"><!-- --></div>\n\
<div class="line6"><!-- --></div>\n\
<div class="line7"><!-- --></div>\n\
<div class="line8"><!-- --></div>\n\
<div class="line9"><!-- --></div>\n\
<div class="line10"><!-- --></div>');

I edited this in jquery.ValidateEngine.js. But vain. Do anyone know the correct format to get the arrow on the right and left.

TIA

Well I had the same problem, so I updated the CSS with:

.formError .formErrorArrow .sideline12 {
    width: 1px;
    height: 15px;
    border: none;
    float: left;
}

.formError .formErrorArrow .sideline11 {
    width: 1px;
    height: 13px;
    border: none;
    float: left;
    margin-top: 1px;
}

.formError .formErrorArrow .sideline10 {
    width: 1px;
    height: 11px;
    border: none;
    float: left;
    margin-top: 2px;
    border-top: solid 4px #fff;
    border-bottom: solid 4px #fff;
}

.formError .formErrorArrow .sideline9 {
    width: 1px;
    height: 9px;
    border: none;
    float: left;
    margin-top: 3px;
    border-top: solid 4px #fff;
    border-bottom: solid 4px #fff;
}

.formError .formErrorArrow .sideline8 {
    width: 1px;
    height: 7px;
    border: none;
    float: left;
    margin-top: 4px;
    border-top: solid 4px #fff;
    border-bottom: solid 4px #fff;
}

.formError .formErrorArrow .sideline6 {
    width: 1px;
    height: 5px;
    border: none;
    float: left;
    margin-top: 5px;
    border-top: solid 4px #fff;
    border-bottom: solid 4px #fff;
}

.formError .formErrorArrow .sideline6 {
    width: 1px;
    height: 3px;
    border: none;
    float: left;
    margin-top: 6px;
    border-top: solid 4px #fff;
    border-bottom: solid 4px #fff;
}

.formError .formErrorArrow .sideline5 {
    width: 1px;
    height: 1px;
    border: none;
    float: left;
    margin-top: 7px;
    border-top: solid 4px #fff;
    border-bottom: solid 4px #fff;
}

.formError .formErrorArrow .sideline4 {
    width: 1px;
    height: 7px;
    border: none;
    float: left;
    margin-top: 8px;
    background: #fff;
}

.formError .formErrorArrow .sideline3 {
    width: 1px;
    height: 5px;
    border: none;
    float: left;
    margin-top: 9px;
    background: #fff;
}

.formError .formErrorArrow .sideline2 {
    width: 1px;
    height: 3px;
    border: none;
    float: left;
    margin-top: 10px;
    background: #fff;
}

.formError .formErrorArrow .sideline1 {
    width: 1px;
    height: 1px;
    border: none;
    float: left;
    margin-top: 11px;
    background: #fff;
}

.formError .formErrorArrow .rightSideArrow {
    width: 14px;
    margin-left: 2px;
    margin-bottom: 7px;
    z-index: 5;
    background-color: transparent;
    border-color: transparent;
    vertical-align: middle;
}

And ths JS with:

case "centerRight":
    prompt.find(".formErrorContent").before(arrow);
    arrow.addClass("formErrorArrowRight").html('<div class="rightSideArrow"><div class="sideline1"><!-- --></div><div class="sideline2"><!-- --></div><div class="sideline3"><!-- --></div><div class="sideline4"><!-- --></div><div class="sideline5"><!-- --></div><div class="sideline6"><!-- --></div><div class="sideline7"><!-- --></div><div class="sideline8"><!-- --></div><div class="sideline9"><!-- --></div><div class="sideline10"><!-- --></div><div class="sideline11"><!-- --></div><div class="sideline12"><!-- --></div></div>');
break;

And HTML:

<script>
        jQuery(document).ready(function(){
            jQuery("#formID").validationEngine({ promptPosition: "centerRight" });
        });
</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM