Chris Halcrow
Chris Halcrow

Reputation: 32010

JQuery not finding page elements

On this page:

http://www.lesmills.com/westcoast/clubs-and-facilities/facilities-and-health-clubs.aspx#

When you mouse over the magnifying glass in the top-right corner, it's supposed to pop up a search box. The reason it's not working is that JQuery can't find the element with id="search" that it needs to attach the mouseover event to. You can see this if you click F12 to bring up the developer tools in the browser and look at the 'console' tab of the developer tools. The feature is working on this page:

http://www.lesmills.com/westcoast/instructors/instructors.aspx

I've been looking at this for a few hours, any ideas?

Upvotes: 0

Views: 58

Answers (2)

Arun P Johny
Arun P Johny

Reputation: 388436

Since $ != jQuery in the page... either use jQuery(selector) instead of $(selector) or use an IIFE

(function($){
    //here $ is jQuery
})(jQuery)

if you are using dom ready handler

jQuery(function($){
        //here $ is jQuery
})

Upvotes: 2

GregL
GregL

Reputation: 38151

The $ function on ASP.net pages, by default, is not jQuery. It is a function defined by ASP.net.

jQuery is loaded on the page, however, and can be accessed by using the full word jQuery, as in jQuery('div.promo-panel').

Upvotes: 2

Related Questions