Please read this documentation https://developer.wordpress.org/reference/functions/wp_enqueue_script/
You need to set 5th parameter to true so the javascript is loaded in the footer.
wp_enqueue_script( 'tyc_scripts', get_theme_file_uri('/js/tyc_scripts.js'), array(), false, true );
if the issue still persists please add your js code inside jquery document.ready()
Related Posts:
- Babel 7 – ReferenceError: regeneratorRuntime is not defined
- How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
- How can I check for “undefined” in JavaScript?
- How to make history.back() without getting a warning on the browser to reload the page?
- Split string into array
- convert Hsl to rgb and hex
- TypeError: Router.use() requires middleware function but got a Object
- What does jQuery.fn mean?
- “Uncaught TypeError: Cannot read property ‘style’ of null at.. “
- Difference between document.referrer and window.parent.location.href
- JavaScript replace/regex
- how to render a react component using ReactDOM Render
- Cannot find module ‘@angular-devkit/core’
- iFrame onload JavaScript event
- What is the difference between state and props in React?
- Regex for password must contain at least eight characters, at least one number and both lower and uppercase letters and special characters
- OnChange event using React JS for drop down
- how to get the last character of a string?
- Set timeout for ajax (jQuery)
- Escaping Discord subset of markdown
- ESLint Parsing error: Unexpected token
- Angular ForEach in Angular4/Typescript?
- How to convert JSON object to JavaScript array?
- How can I display a JavaScript object?
- JSLint says “missing radix parameter”
- How to handle ETIMEDOUT error?
- bootstrap-datetimepicker for bootstrap 4
- Proper way to wait for one function to finish before continuing?
- XMLHttpRequest module not defined/found
- How to print HTML content on click of a button, but not the page?
- explode string in jquery
- How do I create and read a value from cookie?
- Check if a variable is of function type
- Bootstrap 4 Dropdown Menu not working?
- document.getElementsByClassName().innerHTML always returns “undefined”
- Bower: ENOGIT Git is not installed or not in the PATH
- Converting an object to a string
- Truncate a string straight JavaScript
- Phone mask with jQuery and Masked Input Plugin
- JQuery get all elements by class name
- SyntaxError: expected expression, got ‘<'
- Attaching ‘onclick’ event to D3 chart background
- declaration or statement expected javascript/typescript
- The preferred way of creating a new element with jQuery
- How to pass parameters using ui-sref in ui-router to controller
- Get class list for element with jQuery
- Object Dump JavaScript
- Convert array to JSON
- Is there a way to read standard input with JavaScript?
- How to disable scrolling temporarily?
- JSON.stringify (Javascript) and json.dumps (Python) not equivalent on a list?
- HTML/Javascript change div content
- How do you remove all the options of a select box and then add one option and select it with jQuery?
- Add and remove multiple classes in jQuery
- How To Save Canvas As An Image With canvas.toDataURL()?
- How to disable auto-start of “Node.js: Server-side JavaScript” when using Adobe Dreamweaver?
- How to disable button in React.js
- What’s the effect of adding ‘return false’ to a click event listener?
- New line in JavaScript alert box
- How do I download a file with Angular2 or greater
- What are alternatives to document.write?
- What are differences between SystemJS and Webpack?
- How to find if div with specific id exists in jQuery?
- TypeError: $ is not a function WordPress
- Glidejs with WordPress
- Include jQuery UI as a whole
- How to echo JS right after enqueued script to put it into noConflict mode?
- Hooking a callback into the code within a Gutenberg block
- How to add JavaScript code on WordPress properly?
- Disable unneeded scripts in a wordpress installation
- How to report JavaScript errors in the admin panel
- Using wp_editor in TinyMCE WindowManager dialog
- Gutenberg add extra attributes to custom format
- Gutenberg getMedia() in post query doesn’t return all featured images
- Can I change an external script’s HTML?
- Adding and removing hidden buttons from WordPress Customizer Tinymce widget editor using javascript API
- Scripts not loading through function Method in WordPress Theme
- How to install cool javascript feature in WordPress?
- Custom Gutenberg block: access dom element via JavaScript
- Normal for scripts to be loaded after body tag?
- Sliding pages + wordpress [closed]
- JS / jQuery in Elementor pages vs JS file
- Script widget works only in admin view but not in Public
- JS inside modal doesn’t work
- How to Get Post Meta in .Js File [duplicate]
- Google Tag Manager only load when connected to Admin
- Darkmode Custom CSS Toggler – Uncaught TypeError
- Error on clicking ‘Screen Options’ tab only at Products-related editor screen(s) and for specific user
- Development desktop/responsive
- How can javascript be added to a custom-page.php template?
- How do I call for two js files into a custom template?
- How to delay display of page elements until enqueued script has injected html
- Javascript file doesn’t load
- JavaScript problem in a WordPress PAGE
- Receive “menu-toogle” event from section menu in customizer
- How could I add load more posts to my theme? [closed]
- Live Time on WP showing weirdly [closed]
- Javascript button to call custom fields data
- Table block variation with header section activated
- How can I look at/edit what’s being sent to post.php when I hit the publish/update button?