Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change the image inside an HTML5 form-validation message?

Using this article, I'm changing the styling of some of my HTML5 form-validation pop-ups. However, my error pop-ups still have the default, orange exclamation point in the error, in addition to the new red X I've added. How do I get rid of the orange exclamation point (see image below). So far, I'm only testing in Chrome.

sample error message

Here is the CSS that I'm using from that article:

::-webkit-validation-bubble-message 
{
    color: #eee;
    background: #000;
    border-color: #444;
    -webkit-box-shadow: 4px 4px 4px rgba(100,100,100,0.5);
}

::-webkit-validation-bubble-message:before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 4px;
    background: url(/myPath/myImage.png)
}

::-webkit-validation-bubble-arrow {
    background: #000;
    border-color: #444;
    -webkit-box-shadow: 0 0 0 0;
}
like image 412
WEFX Avatar asked Jul 30 '12 18:07

WEFX


People also ask

How do I bypass HTML5 validation?

To ignore HTML validation, you can remove the attribute on button click using JavaScript. Uer removeAttribute() to remove an attribute from each of the matched elements.

How do I change the pattern text in HTML5?

Replacing the Default HTML5 Validation MessageBegin by adding an id to the input element, so as to be able to select it conveniently. var input = document. getElementById( 'username' ); Lastly, we specify the message used when the input shows its invalid state.

Which are the correct input restrictions used for validation purpose in HTML5?

Validation-related attributesThe value must be greater than or equal to the value. There must be a value (if set). Unless the step is set to the any literal, the value must be min + an integral multiple of the step. The number of characters (code points) must not be less than the value of the attribute, if non-empty.


1 Answers

Try:

input::-webkit-validation-bubble-icon {
display: none;
}

or, of course:

input::-webkit-validation-bubble-icon {
background: url(http://google.com/favicon.ico);
}

Jsfiddle here: http://jsfiddle.net/xhqhV/

like image 175
null Avatar answered Nov 15 '22 08:11

null