May 23, 2013
Is this jquery or just javascript?
SJS’s Question:
I am really a backend java programmer but I am working on a project that has some frontend code. I have a question with the following code is the
.validate
Just plan javascript or is it part of jquery?
<script src="/common/js/jquery.maskedinput.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
// apply the masked input format to the phone number field
$("#phonenumber").mask("999-999-9999");
$("#memberrequest").validate({
rules: {
phonenumber: {
minlength: 12,
maxlength: 12
},
content: {
minlength: 3,
maxlength: 1000
}
}
});
});
</script>
Not being a javascript/frontend guy can someone put some light on this
I am disappointed at the quality of answers here. I will try to answer in another way:
<script type="text/javascript">
$(document).ready(function () {
//^ This is the DOM Ready event of jQuery so it is event handler in jQuery
// apply the masked input format to the phone number field
$("#phonenumber").mask("999-999-9999");
//^ $ is most commonly read as jQuery nowadays
// But, since you imported a file before with the name "jqery.maskedinput.js" it is also jQuery
$("#memberrequest").validate({
// ^ Just like the masked plugin above,
// this is another plugin written in jQuery
rules: {
phonenumber: {
minlength: 12,
maxlength: 12
},
content: {
minlength: 3,
maxlength: 1000
}
}
});
});
</script>