0
$("#j_menu a").click(function(e) {
var goto = $("#"+$(this).attr('href').replace('#','')+"");
$('html, body').animate({
scrollTop: goto.offset().top
}, 'slow');
});
He accuses a mistake saying he can’t read ". top" but on another site I’m building he recognized.
I added a condition to check if the element really exists.
if (goto.length) { $("html,body").animate(...) }
– Valdeir Psr
The id generated by
"#"+$(this).attr('href').replace('#','')+""
exists on the page ? Makeconsole.log(goto);
exactly following the definition of the variablegoto
to see what value it is building.– Isac