That worked for me:
wp_enqueue_script(
'YOUR_SCRIPT_NAME',
get_stylesheet_directory_uri() . '/YOUR_SCRIPT_FILE.js',
array(),
'4.7.3',
true
);
Notes:
- I usually name the script just as its file name.
- You don’t have to use the version number 4.7.3, but you do need to write some plausible version number (like of your WordPress core version) or the keyword
null
instead.
Related Posts:
- ReferenceError: $ is not defined
- React.js: Set innerHTML vs dangerouslySetInnerHTML
- JS/Ionic:TypeError: Cannot read property ‘code’ of undefined
- Sort array of objects by string property value
- Chrome sendrequest error: TypeError: Converting circular structure to JSON
- How to deal with floating point number precision in JavaScript?
- What’s a maximum call stack size exceeded error and how to fix it?
- NPM ELIFECYCLE error – using node server.js command
- Is there a link to the “latest” jQuery library on Google APIs?
- How do I correctly clone a JavaScript object?
- Failed to load resource: net::ERR_FILE_NOT_FOUND loading json.js
- Get class name using jQuery
- How to clear the canvas for redrawing
- No value accessor for form control
- React eslint error missing in props validation
- How to specify multiple conditions in an if statement in javascript
- Mongoose – What does the exec function do?
- Developing an ad with MRAID.js
- ReferenceError: Invalid left-hand side in assignment
- How to detect Safari, Chrome, IE, Firefox and Opera browser?
- character counter – backspace doesn’t reflect on characters remaining
- How does the double exclamation (!!) work in javascript?
- Add days to JavaScript Date
- illegal use of break statement; javascript
- Open URL in same window and in same tab
- ReferenceError: document is not defined (in plain JavaScript)
- JavaScript innerHTML not updating element
- Palindrome check in Javascript
- Console is throwing Unterminated JSX contents error
- Console.log not working at all
- Make Axios send cookies in its requests automatically
- How to move an element after another element using JS or jquery?
- Converting any string into camel case
- Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode
- How to use Javascript to read local text file and read line by line?
- Why is the jquery script not working?
- JQuery Datatables : Cannot read property ‘aDataSort’ of undefined
- includes() not working in all browsers
- How to add onload event to a div element
- Access Control Origin Header error using Axios
- Structs in Javascript
- Refused to execute script, strict MIME type checking is enabled?
- Error: [ng:areq] from angular controller
- getElementsByAttribute() is not a function
- Javascript onload not working
- How to parse float with two decimal places in javascript?
- Checking for duplicate strings in JavaScript array
- How to get current date in jQuery?
- Print the contents of a DIV
- Remove all special characters except space from a string using JavaScript
- How to Scroll Down – JQuery
- setInterval with loop time
- JavaScript by reference vs. by value
- What does the .subscribe() function do?
- is there something like isset of php in javascript/jQuery?
- jQuery – Dynamically Create Button and Attach Event Handler
- Highlight a word with jQuery
- How to disable auto-start of “Node.js: Server-side JavaScript” when using Adobe Dreamweaver?
- Regular expression to validate US phone numbers?
- How should I initialize jQuery?
- How to reload page every 5 seconds?
- How do I handle newlines in JSON?
- Update style of a component onScroll in React.js
- Fire oninput event with jQuery
- WordPress Bootstrap Handburger Menu Wont Open
- Reset Undo on the tinymce editor
- Detecting WordPress Customizer Panel
- How to disable hoverIntent in WordPress 3.3 admin
- Customizer – instantiating settings and controls via javascript
- How do I enqueue(or delay loading of) tags in individual page posts?
- JavaScript in page doesn’t open new window [closed]
- wp_enqueue_script adds only the first script
- Animations are not being triggered on Scroll
- Preserve Javascript Through Customizer Preview Navigation
- JavaScript in WordPress Customizer
- Using wp_localize_script inside template page to transfer var from php to js
- Setting a menu link to open a pop-up
- Media library not working with wp_editor() on the front end
- Is there a media_upload_tabs-similar filter to add tabs to the simple/featured image picker?
- Tinymce.js editor in Chrome?
- Display a div when post has a certain tag
- My Button Default Click Is Not Working In WordPress Using Javascript Code
- Implementing Webflow JS in WordPress
- This page can’t load Google Maps correctly [closed]
- Gutenberg RangeControl
- WordPress opens js files as a catalog. Path is right [closed]
- Javascript to open new window
- Add Paypal button redirect to a specific page after completing
- Javascript File Does Not Work
- Gutenberg sidebar show input field on toggle
- Get the ID of a page in Parent combobox in editor
- Google Page Speed
- Can’t Listen to KeyDown in TInyMCE Iframe (jQuery) and Pass it to Parent HTML FORM
- Is it feasible to call angular’s page from wordpress website?
- Trying to deque some .js from source
- How to Create a Repeatable Meta Box
- WordPress Gutenberg: Attribute overwritten by block duplicate
- Why isn’t my SVG path rotating on scroll on iPhones?
- Working with a non-React external library in a custom block
- Using a form to pass GET parameters and create an array of posts accordingly