Javascript examples for DOM HTML Element:Figure
The Figure object represents an HTML <figure> element.
You can access a <figure> element by using getElementById():
<!DOCTYPE html> <html> <body> <figure id="myFigure"> <img src="http://java2s.com/resources/a.png" alt="alt message" width="300" height="200"> </figure>/*w w w .j av a2 s. c o m*/ <button onclick="myFunction()">get the id of the FIGURE element</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myFigure").id; document.getElementById("demo").innerHTML = x; } </script> </body> </html>