How to toggle elements in and out of DOM using jQuery detach() method?

后端 未结 4 2118
-上瘾入骨i
-上瘾入骨i 2020-12-11 08:29

I have a group of divs arranged in a grid.

To style each div I\'m selecting them with the nth-child() pseudo-class.

div.tile:nth-child(4n-7)         


        
4条回答
  •  误落风尘
    2020-12-11 09:02

    I have used remove() with toggle to remove and delete elements. example: each time on mouse hover and check if text is printed in unordered list and then elements are removed on the next click. Jquery

            $('h1').hover(function(){
                    //alert('test toggle');
                   remove_el();
                   for(var i=0;i<5;i++){ 
                   $('ul').append('
  • '+'END_check else'+i+'
  • ').toggle(); } } ); function remove_el(){ $('li').remove(); };

提交回复
热议问题