Javascript - railscast 205

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

$(function() {
$(“#alert”).click(function() {
alert(this.getAttribute(“data-message”));
return false;
})
})

</script>

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

Here

Try:

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

Here

On Fri, May 18, 2012 at 9:23 AM, Christopher D.
[email protected]wrote:

     alert(this.getAttribute("data-message"));

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

  • Aziz M. Bookwala

Website http://azizmb.in/ | Twitter https://twitter.com/azizbookwala
|
Github http://github.com/azizmb

azizmb.in wrote in post #1061246:

Great thanks!