JQuery date picker does not firing in ajax page using Rails
- by prabu
Hi
Here I have using datepicker from JQueryUI
in my public/javascript folder as effects,prototype,control,dragdrop js files.
in my public folder contains jqueryui development buddle. (css,js,development-bundle)
in layout/application.rhtml
<%= stylesheet_link_tag 'application' %>
<%=javascript_include_tag :defaults%>
<%= stylesheet_link_tag '/jquery-ui/css/custom-theme/jquery-ui-1.8.1.custom.css' %>
<%=javascript_include_tag "/jquery-ui/js/jquery-1.4.2.min.js"%>
<%=javascript_include_tag "/jquery-ui/js/jquery-ui-1.8.1.custom.min.js"%>
<script>
$(document).ready(function(){
var $j=jQuery.noConflict();
$j( '#date' ).datepicker({ dateFormat: 'dd-mm-yy' });
});
</script>
in home/index.rhtml
<%title "Home"%>
<%=link_to "Add Details" ,:action=>"add"%>
<%=link_to_remote "Ajax Add Details", :update=>"add" , :url=>{ :action=>"add" }%>
<div id='add' />
in home/add.rhtml
<%title "Add details"%>
<%form_tag :action=>"create" do%>
Name : <%=text_field_tag "name" ,"",:size=>15%>
DOB : <%=text_field_tag "dob","",:id=>"date"%>
<%=submit_tag "Save"%>
<%end%>
the datepicker works when I run home/add.rhtml directly but
the datepicker not work when i run ajax page home/index.rhtml
Any solutions for that,????