I am trying to disable <a>
elements (they have to be this rather than buttons because they are part of the dropdown for a bootstrap dropdown button) if they have the .menuitem-disabled
class.
The click functionality for the <a>
elements is being provided by the knockout click:
binding (href="#"
on all of them)
I put the following code at the top of my javascript. If I break on the line that assigns the click events, I can see that all the corrected elements are being selected by jquery, but the click:
binding fires anyway.
$(window).load ->
loadBindings()
ko.applyBindings new ViewModel()
$(".menuitem-disabled").click (e) ->
e.stopImmediatePropagation()
I have also tried e.preventDefault()
with the same results.
Does anyone have any idea how to accomplish this correctly / what is wrong with my code?