August 30, 201115 yr hello Giuys, i am quite new to jquery?? i wanna know how to select a div to animate on button click.. i am using this code $("#button").click(function () { $(this).animate({ top: '-=480px' }, 1700); }); But i guess instead of this i use #div name i did but it dont work.. Please Help.. Thanks.. Edited August 30, 201115 yr by Renaissance-Design
August 30, 201115 yr Your code there means: $("#button").click(function () { // when #button is clicked $(this).animate({ // animate #button ("this" refers to the selector) top: '-=480px' }, 1700); }); All you need to do is replace "this" with the element you need to target. Also, unless it's a form, don't use a button. Use a link. Edited August 30, 201115 yr by Renaissance-Design
Create an account or sign in to comment