There are a few possible culprits for your issue:
If the script file for this function is loaded before jquery is loaded, you may see a jquery is not defined error in the debugger/console. If that’s the case, just change the order of your script loading to ensure the dependencies are loaded first.
If the function is being added directly into the wysiwyg body area or a template file and not a js file for the theme, you may need to call
jQuery.noConflict(). See the jQuery documentation about when and why you would use this.