Home > Web Front-end > JS Tutorial > body text

Crash example about a semicolon in js_javascript skills

WBOY
Release: 2016-05-16 17:16:20
Original
910 people have browsed it
Copy code The code is as follows:

if ($("span", $("#txtStere") .siblings("div")).text() === "*");
{
if (!IsNum("#txtStere")) {
$("#txtStere"). next().text("The freight template you selected is priced by volume, and the logistics volume cannot be empty and must be a number");
return false;
} else {
$("#txtStere" ).next().text("");
}
}

The above js code will execute the code in curly brackets regardless of whether the result of the if condition is true or false. I After working for more than an hour, I couldn’t figure out what was going on. It crashed and crashed. Finally, by some strange coincidence, I discovered the reason. There was an extra semicolon after the parentheses of the if condition. Is it true? It crashed!
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template