0

I'm getting the following error when I use this piece of script:

<script type="text/javascript">
        $(function() {
            $('form').validVal(); // line 37
        });
    </script>

Error:

"Object doesn't support this property or method" - Line 37, Char 4

Can anyone explain how I fix this?

Is this a common error with IE/IE8?

Thanks for any pointers

6
  • You sure you don't get this error in other browsers, IE in debug mode shows such errors, maybe you run those others without error reporting... Commented Nov 24, 2011 at 14:06
  • Have you included the validVal script on the page? Commented Nov 24, 2011 at 14:06
  • Hi ipr101, yep I've added it on Line 13. Do you want me to post any of that script? It can be found here: validval.frebsite.nl/usage.php Commented Nov 24, 2011 at 14:10
  • 1
    Be sure that the link is valid (open page source and follow the link if the source viewer allows you for that) Commented Nov 24, 2011 at 14:16
  • 1
    Try giving the form an ID and select it using its ID: $('form#myForm').validVal(); Commented Nov 24, 2011 at 14:17

1 Answer 1

2

Before you can use validVal method, you need to make sure to include the validVal plugin:

<script src="jquery.validVal.js" type="text/javascript"></script>

Second, check the selector - the way it is now it will apply this to every form element on the page. You probably want to add something like id="myForm" to your form element and then use

$('#myForm').validVal();
Sign up to request clarification or add additional context in comments.

1 Comment

False alarm people. My bad. I loaded a 2nd version of jQuery for an element further down the page. I have since removed this and all is glorious. My apologies for wasting your time here. Lesson learned. Thanks for the feedback and comments however.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.