i try to show one element of a class with this jquery code:
jQuery('.slide_cover').get(0).toggle(800);
but i get this error:
Uncaught TypeError: undefined is not a function
and code lick this works fine:
jQuery('.slide_cover').toggle(800);
also if i try to get the element in console so it works
jQuery('.slide_cover').get(0)
Can you help me? Thank you!
When you're using get(), jQuery returns the native (underlying) DOM object from the array of elements in context and that HTMLElement doesn't provide the toggle() method.
If you want to call toggle only on the first element in context, try this:
jQuery('.slide_cover:first').toggle(800);
See Documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With