I am getting the following error:
Uncaught TypeError: $.tiggle_toc is not a functiononclick @ 195:189
The code calling tiggle_toc
is onclick: "$.tiggle_toc()"
in a Rails
link_to
. Here is the javascript (cofeescript) which defines tiggle_toc
:
$.tiggle_toc = () ->
console.log('TOGGLE TOC')
$('.toc_level2').toggle()
$('#toc_toggle').click ->
$.tiggle_toc()
In another place I have
%span{title: 'Hide/show subsections', id: 'toc_toggle'}= link_to ETC
Thus clicking on this element in the browser will call tiggle_toc
.
This works just fine.
The mystery (for me) is why in one case the call to tiggle_toc
succeed
whereas in another case it does not.
Any help is greatly appreciated.