Hi I am learning to use jQuery but I can't seem to get the following
line to work from my html.erb file

<script type="text/javascript">
document.write("<p>Hello from javascript!</p>")
$("<p>Hello from jQuery!</p>")
</script>
</p>


I see the output for the basic javascript call, but nothing from
jQuery, what am I doing wrong?

I know Rails 3.2 comes with jQuery installed and I do see it in the Gemfile:

gem 'jquery-rails'


--
Kind Regards,
Rajinder Yadav

SafetyNet Test Driven Development
http://safetynet.devmentor.org

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Dev Guy at Feb 13, 2012 at 9:20 am

    On Mon, Feb 13, 2012 at 2:01 AM, Dev Guy wrote:
    Hi I am learning to use jQuery but I can't seem to get the following
    line to work from my html.erb file

    <script type="text/javascript">
    document.write("<p>Hello from javascript!</p>")
    $("<p>Hello from jQuery!</p>")
    </script>
    </p>


    I see the output for the basic javascript call, but nothing from
    jQuery, what am I doing wrong?

    I know Rails 3.2 comes with jQuery installed and I do see it in the Gemfile:

    gem 'jquery-rails'
    I figured out I need to use:

    $("<p>Hello from jQuery!</p>").appendTo('body')

    --
    Kind Regards,
    Rajinder Yadav

    SafetyNet Test Driven Development
    http://safetynet.devmentor.org

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedFeb 13, '12 at 7:01a
activeFeb 13, '12 at 9:20a
posts2
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Dev Guy: 2 posts

People

Translate

site design / logo © 2022 Grokbase