Here is the small piece of code, which you can use $("#scroll-btn").click(function (){ $('html, body').animate({ scrollTop: $(".area").offset().top }, 800); return false; });
To begin with you need to install the Capybara gem gem install capybara Once the gem is installed you can follow the below mentioned procedure. nishant@Nishant-Lap:~/Desktop/capybara$ rails c Loading development environment (Rails 3.2.13) 1.9.3p392 :001 > require 'capybara/dsl' => true 1.9.3p392 :002 > include Capybara::DSL => Object 1.9.3p392 :003 > Capybara.default_driver = :selenium => :selenium 1.9.3p392 :004 > visit "http://google.com" => "" 1.9.3p392 :005 > page.fill_in('q', :with => 'nishant nigam')
Cause of this issue is the javascript goes in to a textarea tag and when these contents are extracted from the textarea double quotes(") gets converted to (") Solution ( create.js.erb ): <% if remotipart_submitted? %> $('.form-wrapper').html("<%= j "#{render('form')}" %>"); <% else %> $('.form-wrapper').html("<%= j render('form') %>"); <% end %> More details here Issue on Github