Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using Events Manager Plugin

Javascript is not working on Submit Events Page . I found the reason behind this , that was, I have written a line of code in functions.php to call jquery file.

wp_enqueue_script('jquery-1.7.2',get_template_directory_uri().'/js/jquery-1.7.2.min.js');

When I remove this line of code then javascripts start working fine on Event Submission Page but this file is important for me because I am using this file at many places too so I can not remove this. For Example I have a line of code which generates error.Line is :

var p_option = $('input[@name="p_option"]:checked').val(); .

This line is written in 'wordpress_1/wp-content/themes/my-theme/sidebar.php'

I also asked this question on plugin support but no reply from there.

Thanks in advance!!!

share|improve this question
3  
You're enqueuing a specific version of jquery. It's better to enqueue the version that comes with WP, like this: wp_enqueue_script('jquery'); in a function run by the hook wp_enqueue_scripts –  Lea Cohen Jan 29 '13 at 13:09
    
@LeaCohen, I think this could go straight as an Answer... ;) –  brasofilo Jan 29 '13 at 13:18
    
@brasofilo, Thanks for the suggestion. –  Lea Cohen Jan 29 '13 at 18:45
2  
@BhuvneshGupta - WordPress jQuery is in noConflict mode, you must use jQuery as object reference, not $. –  Milo Jan 30 '13 at 5:39
1  
jQuery, not jquery. please read the page I linked above carefully. update your question with your current code. –  Milo Jan 30 '13 at 6:29
show 10 more comments

1 Answer

up vote 2 down vote accepted

You're enqueuing a specific version of jQuery. It's better to enqueue the version that comes with WP, like this: wp_enqueue_script('jquery'); in a function run by the hook wp_enqueue_scripts

share|improve this answer
    
When I am using wp_enqueue_script('jquery'); ** then it is showing error **$ is not a function means javascript is not working. Let me tell you I am writing this in my custom theme's function.php file so is it right way to add jquery file. –  Bhuvnesh Gupta Jan 30 '13 at 5:24
    
@BhuvneshGupta, As written in the codex, and as Milo said in one of the comments to your question, WP runs jQuery in no-conflict mode, which means that the $ shortcut is not available and the longer jQuery is used. I suggest you read a little about it int the codex, in the link I gave. –  Lea Cohen Jan 30 '13 at 6:10
    
I did it. I tried jquery too but not working. Please read our comments conversation. –  Bhuvnesh Gupta Jan 30 '13 at 6:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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