I’m beginner in the programming!Please help me!!!I have the svg animation file and i want when i click the button on my website the svg will play.
But it give me the issue:TypeError: svgObject.beginElement is not a function.
here is my code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>svg</title>
</head>
<body>
<object type="image/svg+xml" id="svganimate" begin="indefinite" data="sample.svg"></object>
<button onclick="playAnimation()">Play Animation</button>
<script>
function playAnimation() {
var svgObject = document.getElementById('svganimate');
svgObject.beginElement();
}
</script>
</body>
</html>
Can someone help me please!