SVG - Change dur value 2

by Salustiano Silva

HTML

<svg width="400px" heigth="400px">
    <rect ry="0" rx="0" x="100" y="100" width="50" height="50" fill="blue" id="rect">
		<animateTransform 
            id="animacao"
			attributeType="xml"
			attributeName="transform"
			type="rotate"
			from="0 125 125"
			to="360 125 125"
			dur="2"
			repeatCount="indefinite" 
		/>
	</rect>
</svg>
<input type="number" id="input_number" name="input_number" />

JavaScript

var input = document.getElementById("input_number");

input.addEventListener("change", function handler(e) {
    document.getElementById("animacao").setAttribute('dur', input.value);
});