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>

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!