I need help with the following code. It includes a line with a marker attached to the end. I have written click events for both the line and the marker. However, the click event does not work when I click on the marker element, and the cursor properties are not being set as expected. How can I properly write click events for the marker element and apply CSS properties?
$("#line12").on("click",function() {
alert("You clicked the line")
})
$("#arrow").on("click",function() {
alert("You clicked the marker")
})
#line12
{
cursor:pointer;
}
#arrow
{
cursor:pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<svg width="600px" height="200px">
<defs>
<marker id="arrow" markerWidth="10" markerHeight="10" refx="0" refy="3" orient="auto" markerUnits="strokeWidth">
<path d="M0,0 L0,6 L9,3 z" fill="#000" />
</marker>
</defs>
<line x1="50" y1="50" x2="250" y2="150" stroke="#000" id="line12" stroke-width="5" marker-end="url(#arrow)" />
</svg>