Rails和jQuery UI datepicker [英] Rails and jQuery UI datepicker

查看:114
本文介绍了Rails和jQuery UI datepicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个text_field_tag,在滑轨中,我已将其ID指定给jquery-ui-datepicker.一切正常.但是即使在刷新页面后,文本字段中的值仍然存在.有什么解决办法吗?

I have a text_field_tag,in rails, I have specified its id to the jquery-ui-datepicker. Everything works fine. But the value in the text field persists even after page refresh. Is there any solution to this?

<%= text_field_tag("meeting_filter_from") %>

jQuery代码:

jQuery('#meeting_filter_from').datepicker({dateFormat: 'MM dd, yy', showOn: 'both', buttonImage: '/images/calendar.gif', buttonImageOnly: true});

推荐答案

准备就绪后,让jquery清除该字段:

On ready, have jquery clear the field:

jQuery(function(){
    jQuery('#meeting_filter_from').val("");
    jQuery('#meeting_filter_from').datepicker({dateFormat: 'MM dd, yy', showOn: 'both', buttonImage: '/images/calendar.gif', buttonImageOnly: true});
});

这篇关于Rails和jQuery UI datepicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆