jQuery toggle and IF visible

前端 未结 3 2261

I have a div which contains settings and options on an account management page.

$(\"#moreOptions\").slideToggle(\'slow\');
if ($(\"#moreOptions\").is(\":visible\         


        
3条回答
  •  不要未来只要你来
    2021-02-13 03:59

    I think this code will work

    $('#element').toggle('slow', function() {
        if($(this).is(':hidden')) { 
            $(this).text('This element is hidden.');
        }
        else {
            $(this).text('This element is visible.');
        }
    }); 
    

提交回复
热议问题