Prev Demo
jQuery
>
.Html() - Get Set Html Content
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <style> #div2{ color:yellow; background-color:green; } </style> </head> <body> <p id="div1">This is DIV1</p> <p id="div2">This is DIV2</p> <p id="div3">This is DIV3</p> <script> alert($("#div2").html()); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output