I'm working with a map of Brazil in SVG, and I need when I click on a state, it adds the "active" class and removes the "active" class from the others. It also has the function of adding the state name to an input.
Example:
<path id="Santa Catarina" class="BR-SC RegiaoSul str1" d="M101205 160059l0 -33 -32 -32 32" />
<script type="text/javascript">
$(docutment).ready(function() {
$(".str1").click(function(){
var state = $(this).attr("id");
$(".str1").removeClass("active");
$(this).addClass("active");
$("input[name=estado]").val( state );
});
});
</script>
With jQuery not working of course, I would like to do this in javascript, can anyone help me?