Smooth Scroll problem

Smooth Scroll problem

Hi guys, so I cant get it to work and I dont see what I am doing wrong. 

I follwed this video step by step:  https://www.youtube.com/watch?v=-SnKQsM_BfQ

and it refuses to smooth scroll, the anchor works though.

I made a separate file called scroll.js with the following code;


$(function(){

$('a[href^="#"]').click(function(){

var target = $(this).attr('href');
var strip = target.slice(1);
var anchor = $("a[name='" + strip +"']");

e.preventDefault();

$('html, body').animate({

scrollTop: anchor.offset().top

},'slow');

});
});


---

In my html document I have these two lines wrapped inside the <head>

    
    <script src="scroll.js"> </script>

I did place them inside <body> also no changes (other than overview is there any difference where I place these? Each tutorial seem to have them in different places)
---

The anchor I have is this;

<a href="#innehall"><img src="/title/down.png" height="42" width="42"/></a>

and it directs to <div id="innehall">

---

Googling forum posts watching other tutorials havent helped me and I really dont know what to do. I checked the code like a thousand times for mistakes but cannot find any. Still, I must be doing something wrong.