jQuery date picker does not firing in ajax page
Hi
Here I have using datepicker from jQuery UI
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
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title><%= h(yield(:title) || "Untitled") %></title>
- <%= 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>
-
- <%= yield(:head) %>
- </head>
- <body>
- <div id="container">
- <%- flash.each do |name, msg| -%>
- <%= content_tag :div, msg, :id => "flash_#{name}" %>
- <%- end -%>
-
- <%- if show_title? -%>
- <h1><%=h yield(:title) %></h1>
- <%- end -%>
-
- <%= yield %>
- </div>
- </body>
- </html>
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 http://localhost:3000/home/add.rhtml directly but
the datepicker not work when i run ajax page http://localhost:3000/home/index.rhtml
Any solutions for that,????