Editor Arrow Download Open
<!DOCTYPE html> <html> <head> <title>jQuery attr() function</title> <script src="jquery-latest.min.js"></script> <script> $(document).ready(function() { var title = $("p#one").attr("style"); $("#div1").text(title); }); </script> </head> <body> <div> <p id="one" style="background-color:#FF9933;">First paragraph start here...</p> <p>Following attribute values come from above paragraph</p> <div id="div1">Attribute values come from above paragraph</div> </div> </body> </html>
  Preview Arrow