0

I used the following code

    wp_register_script('jquery', get_bloginfo('template_directory').'/js/jquery.js', false, '',false);
    wp_enqueue_script('jquery');

It includes the script as

 <script src="http://siteurl.com/wp-content/themes/testtheme/js/jquery.js"></script>

Here how to add the type parameter as type="text/javascript"

Because it creates an error in IE browser

Please help to fix this.

Thanks

7
  • What happens if you enqueue core jQuery library? Does it work?
    – Robert hue
    Jan 28, 2015 at 5:22
  • By using the above code it is working fine in all browsers except i.e. In i.e browser it shows an error as "object expected" in the line of $(doc...ready... line
    – Sam Hanson
    Jan 28, 2015 at 5:28
  • What happens if you do not use template jQuery file? But only use wp_enqueue_script('jquery'); in your functions.php. Does that add type="text/javascript" to script tag?
    – Robert hue
    Jan 28, 2015 at 5:31
  • it didn't add the jquery file , if we use wp_enqueue_script('jquery') alone
    – Sam Hanson
    Jan 28, 2015 at 5:46
  • 1
    Then there is some issue with your WordPress. Replace wp-admin and wp-includes folder completely.
    – Robert hue
    Jan 28, 2015 at 6:09

1 Answer 1

-1

If you are trying to add Jquery lib for your theme then consider using wp_head() just above closing < /head > tag. Wordpress automatically adds a Jquery by default. You need not to add the lib file/ url manually.

2
  • Using wp_head() doesn't enqueue jQuery automatically. jQuery is registered by WordPress core but the theme still needs to enqueue it by using wp_enqueue_script('jquery'); via wp_enqueue_scripts action hook.
    – cybmeta
    Jan 28, 2015 at 7:18
  • oops! i didn't notice that.
    – Shreyo Gi
    Jan 28, 2015 at 9:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.