"Undefined is not a Function" when calling "tabs"

Asked

Viewed 134 times

2

I have an error in my JS function, when I see through the browser, shows the following message:

Undefined is not a Function

Please any hint regarding this error?

<link rel="stylesheet"    href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">

<script>
  $(function () {
    $("#tabs").tabs();// undefined is not a function 
  });
</script>
  • 2

    Already checked if the plugin js has been added and is loading normally?

  • Which plugin are you using? Some data is missing so we can answer your question...

  • Are you selecting the element correctly? Check if there is an element with the ID equal to "tabs".

  • I added the scripts the way it was in the Jquery Demo.

  • Good afternoon, did any of the answers solve your problem? If yes please mark it as "Correct". If you do not say what is missing. Thank you.

3 answers

1

I assume you’re using protocol FILE instead of an HTTP server on your machine.

The use of the abbreviated protocol // only works if the page is loaded on HTTP. On pages with protocol FILE the // is interpreted in Windows for example as D: or C: (or rather saying the // accesses the root folder), instead of pulling from Jquery’s CDN server the files the browser will try to pull from your local machine.

The preference to develop on your machine is to use an HTTP server like:

Read about the HTTP protocol: http://pt.wikipedia.org/wiki/Hypertext_Transfer_Protocol

So when using Apache (for example) with <link href="//..."> the browser will interpret the // as http or https.

The advantage of using // is that your page is HTTPS (http with security certificate), there will be no "security locks" or "error messages" (of course the CDN you use will have to have support for SSL or TLS).

But if you’re sure you won’t use https on your website, so use the http without "abbreviation" or you really want to develop in FILE:

  <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
  <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
  <script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">

0

You must have forgotten to load the plugin code. When trying to call the property .tabs, her value will be undefined and the parentheses will try to invoke it as a function, generating the error.

0

Friend the problem is the path of the plugins, below this the correct

<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.