How to use jquery validation plugin in rails

后端 未结 3 520
被撕碎了的回忆
被撕碎了的回忆 2021-02-06 19:49

How to use jquery validation plugin for the rails form given below.

I want complete steps about how to make the it for different fields

3条回答
  •  死守一世寂寞
    2021-02-06 20:14

    You can use the jquery validation rails gem based on jquery validation plugin. To use it

    1. Add the gem to your gemfile gem 'jquery-validation-rails'
    2. On your app/assets/javascripts/application.js add the following lines

      //= require jquery.validate.additional-methods //= require jquery.validate

    3. As of turbolinks 5 which is included in rails 5 instead of using $(document).ready use $(document).on "turbolinks:load" as described in turbolinks readme

提交回复
热议问题