michaelmcgurk
michaelmcgurk

Reputation: 6509

IE8 Script Error using this simple jQuery declaration

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

Upvotes: 0

Views: 334

Answers (1)

Aleks G
Aleks G

Reputation: 57316

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();

Upvotes: 2

Related Questions