add jquery to wordpress
add_action( 'wp_enqueue_scripts', 'add_my_script' );
function add_my_script() {
wp_enqueue_script(
'your-script', // name your script so that you can attach other scripts and de-register, etc.
get_template_directory_uri() . '/js/your-script.js', // this is the location of your script file
array('jquery') // this array lists the scripts upon which your script depends
);
}
// works great but you need to have your jquery script in "/js/your-script.js" with "jQuery" replacing the "$". eg:jQuery(document) instead of $(document)
Also in JavaScript:
- hide div in javascript
- how to set input of time type to current time on initialization
- phantomjs in angular
- javascript pass function as parameter
- js random number
- es6 array sum javascript
- axios response.json
- jquery clear form values
- define an unsigned int js
- how to run cypress test
- jQuery change select value
- Searchkick::ImportError: {"type"=>"cluster_block_exception"
- typeof javascript
- backgroundImage react
- data for bar plot json
- how to append the dropdown values by jquery each function
- node js version
- javascript to get value of dropdown
- face-api.js
- vue config devtools
- nestjs version
- js anonymous functions
- how to return ascending array using for loop in js
- javascript modify url without reloading page