Manjunath Manoharan
Manjunath Manoharan

Reputation: 4617

Rails and 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 Code:

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

Upvotes: 2

Views: 1016

Answers (1)

jk.
jk.

Reputation: 14435

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});
});

Upvotes: 2

Related Questions