Saturday, 7 September 2013

Using Jquery within rails

Using Jquery within rails

I am trying to use some Jquery witihin a rails application. This is my
first time using Jquery in rails and I cannot seem to get it to work. I am
using rails4 and this is what my code looks like
I have a pages controller with an index action
index action
def index
respond_to do |format|
format.html
format.js
end
end
pages.js
$(document).ready(function(){
$('.button').click(function(){
$(this).fadeOut('slow);
});
});
index.html.erb
<button class="button">Clickme</button>
However I get no response, am I missing something here ?

No comments:

Post a Comment