Ruby on Rails Tuesday, December 1, 2015



On Tuesday, December 1, 2015 at 6:31:16 AM UTC-5, Colin Law wrote:

On 30 November 2015 at 23:58, fugee ohu <fuge...@gmail.com> wrote:
> this snippet which follows another code block under
> $(document).ready(function () {    isn't working, the previous block works,
> but not this one
>
>   $('#listing_free_shipping').change(function(e)
>    {
>     if (e.listing_free_shipping.attr('checked'))
>      {
>      $("#listing_shipping_cost").toggle( "blind" );
>      }
>     else
>      {
>      $("#listing_shipping_cost").show();
>      }
>   })

Just a couple of notes.  The likely reason you have not had any offers
of help with these questions is that it is absolutely nothing to do
with Ruby or Rails, except for the fact that if you are finding that
document ready works sometimes but not others then this is likely due
to the fact that document ready is not compatible with turbolinks (if
you are using that).  Google will explain what to do about it.

The other point I would make is that javascript should not normally be
included in the page, it should be in separate assets files.

Colin

  Commenting out turbolinks in my gemfile didn't help Also, how do i  move my javascript to separate assets files

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a9ea1bfc-4f3e-428b-b843-333392029ed7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment