views:

472

answers:

0

I have tried several methods and keep getting object doesn't support this method error.
I am simply trying to validate if the input in my textbox is a valid number
Following values are ok:

-45  
0.45
-0.45

Page

<head runat="server">
<title></title>
<script type="text/javascript" src="js/jQuery/jquery-1.3.2.min.js"></script>
</head>
<form id="form1" runat="server">
<div class="Edit">
    <input id="Text1" type="text" />
</div>
</form>
<script language="javascript" type="text/javascript">
   $(document).ready(function() {

      $("div[class^='Edit'] :input[type=text]").blur(function() {

         var n = $(this).val() * 1;
         var re = /^\d*\.{0,1}\d*$/; // ^[-+]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?$
     /*
          if (regs = n.match(re)) {
            alert('here');
          }

          if (n.match(new RegExp(re))) {
            DisplayError(this, this, "+ve")
          }
          else {
            DisplayError(this, this, "-ve")
          }
    */

      $(this).validate({
        rules: { number : true }
       });

         //DisplayError(this, this, "He")
            });
        });

        function DisplayError(input, br, message) {
            $(br).after('<span class="displayInlineError">' + message + '</span>');
            $(input).addClass("displayInputError");
            $(input).focus();

        }
    </script>