In rails app, I add the following line of code in application.js and I
get jQuery is not defined in firebug console.
In application.html.erb, I have the following:
and I installed jquery in public/javascripts
Any ideas what’s going wrong? thanks for reply.
(function($) {
var linksToInt = {
"#pple": 0,
"#serv": 1,
"#sol": 2,
"#dash": 3,
"#adm": 4,
"#inv": 5,
"#stu": 6
}
/*
links = document.getElementsByTagName("a");
if(links.className.indexOf("div-link") > -1){
links.onclick = function{
removeHash(this.getAttribute(“href”));};
}
*/
$("a.div-link").click(function(){displayDiv($(this).attr("href"));});
function displayDiv(id){
var linkInt = linksToInt[id];
on_btn_click(linkInt);
}
function on_btn_click(displayDiv){
displayDiv != null ? null : this;
switch(displayDiv){
case 0:
$(content).empty();
$(displayDiv).show();
break;
case 1:
$(content).empty();
$(displayDiv).show();
break;
case 2:
$(content).empty();
$(displayDiv).show();
break;
case 3:
$(content).empty();
$(displayDiv).show();
break;
case 4:
$(content).empty();
$(displayDiv).show();
break;
case 5:
$(content).empty();
$(displayDiv).show();
break;
case 6:
$(content).empty();
$(displayDiv).show();
break;
}
}
})(jQuery);