Javatpoint Logo
Javatpoint Logo

SVG Scripting

Using the JavaScript, it is possible to script the SVG. Through scripting, you can modify the SVG elements, animate them or listen for mouse events on the shapes.

You can work with SVG elements in JavaScript when SVG is embedded in an HTML page.

Example:

Test it Now

Explanation:

  • Using the document.getElementById() function, you can obtain a reference to an SVG shape.
  • The setAttribute() function is used to change the value of attributes.

Next TopicEvent Listener





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA