简体   繁体   English

查找所有活动的就地编辑器

[英]Finding all active in place editors

I have an existing rails form with many sections that can be edited in place, using in_place_editor. 我有一个现有的rails表单,其中有很多部分可以使用in_place_editor进行编辑。 Now I need to detect if any of the in place forms are visible, ie, the user is editing a section, before navigating away from the page. 现在,在离开页面之前,我需要检测是否有任何就位表单可见,即用户正在编辑节。 What's the usual "rails way" of doing this? 这样做的通常的“轨道方式”是什么?

Turns out this was fairly easy during the light of day and some extra coffee: 事实证明,这在白天和一些额外的咖啡下非常容易:

jQuery(".form:visible").length > 0

did the trick. 做到了。 All the forms in question had the class `.form' 所有有问题的表单都有类“ .form”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM