jQuery wrap Method


jQuery wrap method : is used to cover the selected element with another element.


Syntax

$(selector).wrap(element);

jQuery wrap Method Example

jQuery wrap() Method – Example

<script type="text/javascript">
         $(document).ready(function(){ 
              $( "#wrapExample" ).on( "click", function(event) {             
                $("div").wrap("<div style='padding:20px;background:red;'></div>");               
              });
               
          });
</script>

Try it »


Advertisements

Add Comment

📖 Read More