Javascript examples for jQuery Method and Property:wrapInner
Create a new b element and wrap around the content of each p element
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("p").wrapInner(document.createElement("b")); });//from w w w . j a va 2 s . com }); </script> </head> <body> <p>This is a paragraph.</p> <p>This is another paragraph.</p> <button>test</button> </body> </html>