Phenomenon:
Today, I found a good online feedback library for data type validation: "Validator.js", want to test the effect of HTML testing, then wrote the following code:
<HTML><Head><Scripttype= "Text/javascript"src= "Https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></Script><Scripttype= "Text/javascript"src= "Validator.min.js"></Script></Head><Body><Scripttype= "Text/javascript">Window.alert (Validator.isemail ('[email protected]')); //= True</Script><Divstyle= "height:500px; background-color:gray;"> <Divstyle= "position:relative; top:50%;left:50%; Transform:translatey ( -50%) TranslateX ( -50%); background-color:blue; width:200px; height:100px; "> </Div></Div></Body></HTML>
After the operation, error messages are as follows:
inch character class at validator.min.js:@ validator.min.js: Validator.min.js:testdivmiddle.html: uncaught referenceerror:validator is no defined at Testdivmiddle.html:10
Workaround:
Because the bosom is a character set problem, add a line of code like this:
<meta charset= "Utf-8"/>
The result is running normally.
The full code is as follows:
<HTML><Head><MetaCharSet= "Utf-8" /><Scripttype= "Text/javascript"src= "Https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></Script><Scripttype= "Text/javascript"src= "Validator.min.js"></Script></Head><Body><Scripttype= "Text/javascript">Window.alert (Validator.isemail ('[email protected]')); //= True</Script><Divstyle= "height:500px; background-color:gray;"> <Divstyle= "position:relative; top:50%;left:50%; Transform:translatey ( -50%) TranslateX ( -50%); background-color:blue; width:200px; height:100px; "> </Div></Div></Body></HTML>
Missing <meta charset= "Utf-8"/>-raised error