Click here to Skip to main content
15,890,982 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi friends,

In my website have with search button, if i click search icon no result is coming, but in chrome i can find via inspect element the error is like "Uncaught TypeError: $(...).on is not a function"

showing error in 1 st line
PHP
$('.searchInputContainer a.dnnSearchBoxClearText').on('click', function () {
                   var $this = $(this);
                   var $wrap = $this.parent();
                   $('.searchInputContainer input').val('').focus();
                   $this.removeClass('dnnShow');
                   $('.searchSkinObjectPreview', $wrap).remove();
                   return false;
               });


please help me to find solution for this, its more helpful for me.

Thanks & Best Regards
g.renga
Posted

1 solution

Make sure that you have provided a correct reference to the JQuery library.
Something like-
HTML
<script src="Scripts/jquery-1.11.3.min.js"></script>

or, CDN link like-
HTML
<script src="https://code.jquery.com/jquery-1.11.3.min"></script>

Also, make sure that you are referencing to JQuery version 1.7.x or later.

Hope, it helps :)
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 8-Jul-15 1:53am    
5ed. Most likely, this is exactly the essence of the problem. The inquirer should understand that $ is just a valid name for any JavaScript object; it can be defined or not; any piece of code can define it.
—SA
Suvendu Shekhar Giri 8-Jul-15 1:58am    
Thanks. The information you have shared in the comment can also be very useful for the OP if he wants dig further to find the cause. It was missing in the solution.
Thanks again !

Hopefully it resolves OP's problem.
Renga.g 8-Jul-15 3:05am    
thanks all,
let you know if need more information.
best regards
g.renga

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900