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

php - Embed BBCode within itself not working -

three.js - how to load gltf in three JS -

sql server - T-SQL: Access DB objects in same schema without qualifying? -