myFunction 未使用 ActiveAdmin 表单和 Rails 定义



我不明白为什么我有这个问题。这就像我的函数hiddenField()没有被读取。

My form:

f.input :contact, :as => :radio, :collection => ["slide", "formulaire de contact", "map", "video"], input_html: {:class => "select", :onblur => "hiddenField()"}
f.input :title_map, label: I18n.t('title_map'), input_html: {:class => "hidden_title"}, placeholder: "Entrer un titre pour la map"

My Script:

var ready;
ready = function() {
    function hiddenField() {
        $(".select").on( 'click', function() {
            document.getElementsByClassName("hidden_title").removeAttribute("input");
        };
    };
    hiddenField();
};
$(document).ready(ready);
$(document).on('page:load', ready);

谢谢。编辑:

对不起,我忘了。我的表单在admin/page.rb。我使用ActiveAdmin
$(function() {
  $('.select').change(function() {
    $('.hidden_title').removeAttr('input')
  })
})

最新更新