JavaScript JQuery 触发(“点击”)问题
我有一个分为两部分的表格。一部分用于输入数据,接下来的部分是输入数据的列表。当我在表单中 CUD 一个对象时,我想要更新列表,我通过触发器来执行此操作:
jQuery("#magnifier").parent().trigger("click");
由于我公司大量使用 Safari,我必须选择父级,否则 Safari 不会接受触发器。以下代码由 Rails(V 1.2.3)生成,并启动我的列表的更新:
<a href="#" onclick="new Ajax.Updater('list_section', '/input_form/reload_list',
{asynchronous:true, evalScripts:true, parameters:Form.serialize('periode_form')}); return false;">
<img alt="Magnifier" border="0" id="magnifier" src="/images/magnifier.png?1288947266">
</a>
问题是在我的公司 Safari 和 Opera 是最常用的浏览器。我可以让它适用于一种浏览器,但不适用于另一种浏览器。有没有一种方法可以在没有 if opera else 类型的 yacki 代码的情况下实现这一点?
I have a form split up into two parts. One part is for entering data and the following part is a list of the entered data. When I CUD an object in the form I want to update the list, I do this via a trigger:
jQuery("#magnifier").parent().trigger("click");
Due to the heavy use of Safari in my company I had to choose the parent otherwise safari wouldn't accept the trigger. The following code is generated by rails (V 1.2.3) and kicks off the update of my list:
<a href="#" onclick="new Ajax.Updater('list_section', '/input_form/reload_list',
{asynchronous:true, evalScripts:true, parameters:Form.serialize('periode_form')}); return false;">
<img alt="Magnifier" border="0" id="magnifier" src="/images/magnifier.png?1288947266">
</a>
Problem is in my company Safari and Opera are the most used browsers. I can get it to work for one browser but not for the other. Is there a way how I can implement this without a if opera else kind of yacki code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设页面上有一个表单。根据表单的内容,您希望在其他地方更新列表。这很容易做到,并且不需要任何愚蠢的歌剧检查。我的支票显然没有任何 AJAX,所以您必须填写那里的空白。
http://jsfiddle.net/Q7u7f/
I'm going to assume you have a form on the page. Based on the contents of the form, you want a list updated elsewhere. This is pretty easy to do and should not require any goofy opera checks. My check obviously doesn't have any AJAX, so you will have to fill in the blanks there.
http://jsfiddle.net/Q7u7f/