Javascript file not executing when using WordPress child-theme?
-
I’ve linked a custom javascript file in a WordPress child theme using functions.php. The code doesn’t execute when the page loads, however when I run the same code in the console it works. The script loads which can be seen in google inspector under the sources tab. Does anyone know why this happens?
function script_js() { wp_enqueue_script('tradejs', get_stylesheet_directory_uri() . '/js/custom.js', array('jquery')); } add_action('wp_enqueue_scripts','script_js', 2000);Script doesn’t execute when page loads however works when run directly in the console? Ive also tried other code snippets, same results though.
jQuery(document).ready(function ($) { $("input[type='search'").attr("placeholder", "Search CODE or Keyword"); });
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Javascript file not executing when using WordPress child-theme?’ is closed to new replies.