Skip to content
Advertisement

why jQuery functions don’t work together?

I’m new to jQuery, my functions adds class active to buttons when different inputs have value. However, only one function out of two works at once. Both functions work just fine separately. Maybe I am missing something? I writing these functions directly on html file without document.ready, but it didn’t solve the issue. Is there a way to make both of these functions work at the same time?

JavaScript
JavaScript
JavaScript

Advertisement

Answer

Maybe you can give different names to functions since the second one overrides the first one?

Always define the functions before you use them if you don’t use a bundler.

Also, you don’t need to define document.ready multiple times.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement