I'm trying to write some coffeescript to give me back the link that I clicked and I'm having trouble.
The issue is that the element I'm getting back is the selector that starts this chain but that's not what I'm looking for.
$(document).ready ->
$("#js-exercises-links").bind "cocoon:after-insert", (e, inserted_item) ->
$("#js-exercise-links a.add_fields").data("association-insertion-node", '#js-outline-fields')
$("select").chosen()
$(".js-show-set-duration").click (e)=>
e.preventDefault()
console.info this
In this example, when I look at my console I get back <div id='js-exercises-links'> what I really want is the current element I clicked on which would be an instance of <div class='js-show-set-duration'>
What am I doing wrong? How do I get $(this) to reference the element clicked on?