JCS
JCS

Reputation: 907

Jquery "$.uniform is undefined" error

I am using uniformjs to style some html element but when i try to update an element such as a check box using

$.uniform.update('input[type=checkbox]');

I get the error

$.uniform is undefined

any one else have an idea how to solve this?

I have both jQuery and the uniform.js added to the page.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.uniform.min.js" type="text/javascript" charset="utf-8"></script>

What's weird is this worked when it was a regular HTML page and stopped working when i made it into a ASP.NET page and added custom form validators. Perhaps there is some clash?

Upvotes: -5

Views: 5705

Answers (2)

SajjadHashmi
SajjadHashmi

Reputation: 3695

Reason for this error is browser cant identify $.uniform which can be because of following two reasons:

  • You have not included uniform.js file to your page, check if a similar looking lines is present in your markup.

        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
        <script src="jquery.uniform.js"></script>
    
  • You are referencing it before its been loaded (have you included it at the end of the page, after the markup?)

Upvotes: 4

Leonardo Barbosa
Leonardo Barbosa

Reputation: 1406

You have to load all your dependencies and the current library itself to make it work.

For your css:

<link rel="stylesheet" href="uniform.default.css" media="screen" />

For your javascript:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script src="jquery.uniform.js"></script>

Please, check this JSFiddle that I've build for you, showing uniformjs working.

Upvotes: 0

Related Questions