Beldion Bryan Balanan Beldion Bryan Balanan - 1 year ago 43
Javascript Question

Jquery .css to change one style

$(document).on('click', '.close-link', function(){
$(document).find("#followdiv").( "top", "0px" );

I am trying add a style to
<div id="followdiv">
so that it becomes
<div id="followdiv" style="top: 0px;">
. I used this as reference for the code above and I dont know why it won't work.


You can use

    $('.close-link').on('click', function() {
        $('#followdiv').css( "top", "0px" );    

Your div has an id so you can target it directly with jQuery. Also you don't have to use .parent().parent().parent().parent(), there is .closest() you can use