Thursday, May 17, 2012

Re: [Rails] javascript - railscast 205

Try:
  
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.jstype="text/javascript" charset="utf-8"></script>
   <script type="text/javascript" charset="utf-8">
     $(function() {
       $("#alert").click(function() {
         alert($(this).attr("data-message"));
         return false;
       })
     })

   </script>

    <h1><a href="#" id="alert" data-message="Hello UJS!">Click
Here</a></h1>

On Fri, May 18, 2012 at 9:23 AM, Christopher D. <lists@ruby-forum.com> wrote:
I added the following into a page of one of my post view in rails.
However when I click on it it doesn't bring up the "Hello UJS!" what am
I missing here?

   <script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
type="text/javascript" charset="utf-8"></script>
   <script type="text/javascript" charset="utf-8">
     $(function() {
       $("#alert").click(function() {
         alert(this.getAttribute("data-message"));
         return false;
       })
     })

   </script>

    <h1><a href="#" id="alert" data-message="Hello UJS!">Click
Here</a></h1>

--
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 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.




--
- Aziz M. Bookwala

--
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate