I am using rails 4.0 and I want to remove obtrusive javascript. I must be missing something, I have this link_to:
= link_to t('hide'),'#', :'data-hide-table'=>"#row_#{@result.id}", :class=>'hider'
In my model.js I have following code (I have also tried putting it inside application.js):
$(document).ready(function() {
$('.hider').click(function (event) {
console.log("fsg");
$(this).data("hide-table").hide();
event.preventDefault();
});
});
However, nothing is being logged into console, and of course that I need to hide is not being hidden. Btw. everything works when I use:
= link_to_function t('hide'), "$('#row_#{@result.id}').hide()"