Getting 404 in the Javascript

I think this is not good idea – create many enter points. Open Web Inspector and check your URL which using in JS code. But much better use the default admin_url( ‘admin-ajax.php’ ) to creates path which should be used in Java Script.

Issues trying to get an element by id

I didn’t get main part of your question. Still let me try: document.getElementById(‘InOrCm’).value = “in”; That mean you are adding value to the input with id “InOrCm”. If I am getting you then your syntax is right. Double check your ‘id’ name. check with console output. document.getElementById(‘InOrCm’).value = “in”; console.log(document.getElementById(‘InOrCm’).value); Here is second part: function … Read more

javascript not loading

Firstly, you don’t need to add scripts in footer.php manually. Secondly, if there are no script dependencies, you have to declare empty array: array(), rather than array(”). Due this mistake scripts are not loading except Bootstrap. The correct code is: function imk_scripts() { wp_enqueue_script( ‘bootstrap_js’, get_template_directory_uri() . ‘/js/bootstrap.min.js’, array(‘jquery’), ‘3.3.5’, true ); wp_enqueue_script( ‘plugin_js’, get_template_directory_uri() … Read more

How to integrate a JS fiddle?

You’re passing true as the $in_footer argument to wp_register_script(), but my_custom_js() is loading in the header. So doubleScroll is loading after the custom js. I would put my_custom_js() in a separate javascript file so you can control the dependencies. Create my_custom_js.js in the same place you have the double scroll script: jQuery(document).ready(function($) { $(“#double-scroll”).doubleScroll(); } … Read more

Where to paste Google Map Snippet / JavaScript / CSS for WordPress integration

The JS in the fiddle should be saved to a file, for example, scripts.js. If this was in a folder in the theme root called js you could enqueue the scripts like so: function add_wp_scripts() { wp_enqueue_script( ‘google-maps’, ‘https://maps.googleapis.com/maps/api/js’, array(), null, null ); wp_enqueue_script( ‘script’, get_template_directory_uri() . ‘/js/script.js’, array(), null, true ); } add_action( ‘wp_enqueue_scripts’, … Read more

WordPress wp_enqueue_script only adds text to top of page source

You need to wrap your text with <?php and ?>. Like this: <?php function my_scripts() { wp_enqueue_script( ‘jquery’ ); wp_register_script( ‘parallax’, get_template_directory_uri() . ‘/parallax.js’, array( ‘jquery’ ), NULL, true ); wp_enqueue_script( ‘parallax’ ); } add_action( ‘wp_enqueue_scripts’, ‘my_scripts’ ); ?> Otherwise, the PHP parser never sees it – and it’s sent as text to the browser. … Read more

Inherit scripts from parent to childtheme

Thats because parent theme using get_stylesheet_directory_uri() to call script. By this function it is searching for file in your child theme folder (bcause child theme’s style.css is using by active theme) where no such files present. This function search those theme folder whose style.css file is using in active theme. Right now your child theme … Read more