Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

364
Vistas
.slideToggle() not working when using Jquery 3.1.1

For some reason I am getting an Uncaught TypeError when I try and execute the following code.

jQuery(function($){
    $(document).ready(function() {
        $(".block").click(function() {
            var currentElement = $(this).find(".form-group");
            currentElement.slideToggle("slow");
        });
    });
});

I get the following error

Uncaught TypeError: currentElement.slideToggle is not a function
at HTMLDivElement.<anonymous> (index.js:6)
at HTMLDivElement.dispatch (jquery-3.1.1.slim.min.js:3)
at HTMLDivElement.q.handle (jquery-3.1.1.slim.min.js:3)

However when I call currentElement.toggle() It works as expected and I do not get any errors.

Can anyone explain why this is?

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The problem here is you are using the slim version which excludes the effects like the animation expected from slideToggle; so the function isn't defined. Just switch to the normal version.

From the Jquery Page

Slim build

Sometimes you don’t need ajax, or you prefer to use one of the many standalone libraries that focus on ajax requests. And often it is simpler to use a combination of CSS and class manipulation for all your web animations. Along with the regular version of jQuery that includes the ajax and effects modules, we’ve released a “slim” version that excludes these modules. All in all, it excludes ajax, effects, and currently deprecated code.

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda