4 ms·
Sorry but that example code looks confusing as hell. If I saw that code without any context, I really wouldn't be able to tell you what it's doing. Seriously,
by wackget 6y ago
Sorry but that example code looks confusing as hell. If I saw that code without any context, I really wouldn't be able to tell you what it's doing.
Seriously, this is why I hate modern web development. Absolutely everything seems stuffed full of incredibly over-the-top complexity.
Libraries like jQuery get a lot of hate because they're not trendy or supposedly impact performance too much, but unless you're serving thousands of visitors simultaneously you really should care more about code readability and maintainability than any of that.
At least with something like jQuery validation you can actually understand what the code is doing:
$("#myform").validate({
rules: {
name: "required",
email: {
required: true,
email: true
}
},
messages: {
name: "Please specify your name",
email: {
required: "We need your email address to contact you",
email: "Your email address must be in the format of name@domain.com"
}
}
});