I'm developing an ASP.NET app and using jQuery. I have a <div> element with the id='slider'. When trying to access the element using $('#slider'), it returns null, but when trying to access it without the selector, ie. $('slider') the element is returned.
What could be the reason for that?
If the selector doesn't match, then jQuery doesn't return null. So that's two counts of "Acting unlike jQuery" which suggests that the answer is: $ is not jQuery in your page.
Something else is redefining it. Possibly mootools or prototype.js (I'm not sure what either return if there is no matching element, but I'm pretty sure that both have a $ function that takes an id and not a CSS selector as the argument).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With