Unknown Error Unknown Error - 8 months ago 29
jQuery Question

Script not working when I place jquery.js on footer

I place

on my footer before

<script type="text/javascript" src="/js/jquery.js"></script>

And why this code is not firing? But when I move jquery.js on header before
it working fine..

$(document).ready(function () {
$("#main-category").change(function () {
var id = $(this).val();
var dataString = 'id=' + id;
type: "POST",
url: "/select-category/",
data: dataString,
cache: false,
success: function (html) {

Let me know why code above is not firing when I include
on my footer.


I bet you actually put the $(document).ready(function () { }); block before jQuery library. jQuery has to be loaded even before $(document).ready(function () { }); block in order to make it work. However, in all cases, keep jQuery in <head>, that's the right place for it