Skip to content

Instantly share code, notes, and snippets.

@azuby
Created February 8, 2012 21:16
Show Gist options
  • Save azuby/1773953 to your computer and use it in GitHub Desktop.
Save azuby/1773953 to your computer and use it in GitHub Desktop.
From <%= text_field_tag "from", params[:from], class: "datepicker" %>
to <%= text_field_tag "to", params[:to], class: "datepicker" %>
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
ncaught TypeError: Object [object Object] has no method 'datepicker'
(anonymous function) application.js:9748
jQuery.Callbacks.fire application.js:1047
jQuery.Callbacks.self.fireWith application.js:1165
jQuery.extend.ready application.js:436
DOMContentLoaded
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
`$(function(){
$("a.remove-fields-button").click(function(event) {
$(event.target).closest(".fields").hide();
$(event.target).prev("input[type=hidden]").val("true");
$(event.target).closest(".fields").nextAll(".add-fields-button").show();
return false;
});
$("a.add-fields-button").click(function(event) {
$(event.target).hide();
$(event.target).prev("input[type=hidden]").val("false");
$(event.target).prevAll(".fields").show();
return false;
});
$("#from").datepicker("option", "showAnim", "drop");
});`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment