Ruby on Rails: Submit a form as a JS based on a change in select box

后端 未结 3 748
悲&欢浪女
悲&欢浪女 2020-12-21 16:23

I have the following HTML generated by form_tag and select_tag in Rails:

3条回答
  •  庸人自扰
    2020-12-21 16:39

    If you give an id to your tag you can use the id there.

    Like:

    and then:

    $('#folder_name_foldernames').change(function(){
        $('#this_form').submit();
    });
    

    Don't forget to wrap your selectors in quotes or you'll get a JavaScript error.

提交回复
热议问题