javascript - Can’t seem to grab ID and pass it to inner function -


i’m trying id of element on click, , pass animate function inner function.

i can id can’t seem pass inner function.

$("a").on("click",function() {   var id = '#' + $(this).attr('id').substring(2);   $('html, body').animate({     // console.log(id);  not visible ?!     scrolltop: $(id).offset().top   }, 2000); }); 


Comments

Popular posts from this blog

minify - Minimizing css files -

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -