Try:
<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).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-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
- Aziz M. Bookwala
Website <http://azizmb.in/> | Twitter
<https://twitter.com/azizbookwala> |
Github <http://github.com/azizmb>
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.