Wednesday, May 8, 2013

[Rails] Asset pipeline and jQuery scope

Hi,
I'm an amateur learning Rails, and having trouble understanding how to
include different jQuery selectors in the same scope since Rails 3.

eg How do I include $('#big_image'), which is on the same page as
$('#little_image'), in the scope of of the following?

questions.js.coffee:
$('#little_image').click ->
if little_image.style.display == "block" # Hide little image/show
big image
$('#little_image').hide()
$('#big_image').show()

ERROR: Uncaught ReferenceError: big_image_div is not defined

I get why big_image_div is not in the scope of $('#little_image'), but
could use some guidance as to how to go about making this work.


Thanks

--
Posted via http://www.ruby-forum.com/.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate