jQuery addBack() Method


jQuery addBack() Method Adds the previous set of elements to the current set.


Syntax of jQuery Traversing – addBack() Method

$(selector).addBack([selector element]);

jQuery addBack() Method – Example

<script type="text/javascript">
         $(document).ready(function(){         
            $( "#demo-paragraph-before-addback" ).find("p").css( "background","yellow" );
            $( "#demo-paragraph-after-addback" ).find("p").addBack().css( "background","yellow" );
        
          });
</script>

Try it »


Advertisements

Add Comment

📖 Read More