Rules don´t work

Rules don´t work


Hi,

I hope you guys can help me, cause I just started using the form validation for the first time. The validation works when I write the rules within the tags of a form element, e.g.:
  1. <input required id="text"   type="text" >
But it doesn´t work, when I define the rules within the <script>-tag. Where´s the problem? Is there anything faulty in the code?
  1. <?php
    echo '
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
              <html>

              <head>
                 <meta name="" content="" />
                 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">   

                  <script src="script/validation/jquery.js"></script>
                  <script src="script/validation/jquery.validate.js"></script>
                 
                              
                  <script type="text/javascript">
                   $(document).ready(function(){
                      $("#test").validate({
                          rules: {
                              text: "required",
                              text2: "required",
                              text3: {
                                 required : true,
                                 min : 2
                              }
                          }
                      });
                   });
                 </script>
                 
              </head>
              
              <body>
              <form id="test" action="'.$_SERVER['PHP_SELF'].'" method="post"  >
                <input  id="text"   type="text" >
                <input  id="text2" type="text" >
                <input  id="text3" type="text" >
                <input type="submit">
              </form>

              </body>
              </html>
    ';        
           
    ?>