I'm trying to use the jQuery Datepicker to set a date field in my Ruby on Rails form, but I can't work out how to do it. Can someone point me in the right direction?
A:
Since Rails uses Prototype, you'll need to use jQuery in noConflict mode. Make sure you include jQuery after Prototype has been loaded using something similar to:
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jqueryui.js"></script>
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function($) {
// here the $ function is jQuery's because it's an argument
// to the ready handler
$('#dateField').datepicker();
});
// here the $ function is Prototype's
</script>
tvanfosson
2010-07-25 14:17:25
+1
A:
Ryan Bates has a really great explanation of all of this:
Christian Bankester
2010-07-26 00:54:33