So i\'m having some issues with my JQuery which is suppose to scroll to particular divs.
HTML
You can do this:
$('.searchbychar').click(function () {
var divID = '#' + this.id;
$('html, body').animate({
scrollTop: $(divID).offset().top
}, 2000);
});
F.Y.I.
. (dot) like in your first line of code.$( 'searchbychar' ).click(function() {$('.searchbychar').attr('id') will return a string ID not a jQuery object. Hence, you can not apply .offset() method to it.