Rails 3.1 rc4 and Jquery: beginner's question -
i'm new jquery , upgraded rails 3.1 rc4 , i'm starting new project.
so far i've figured can convert jquery code coffeescript , place in something.js.coffee, example
but: should place pure jquery code?
i'm trying simple example work: http://api.jquery.com/hide/ i've tried putting following code in application.js , home.js.coffee nothing worked far..
$("p").hide(); $("a").click(function ( event ) { event.preventdefault(); $(this).hide(); });
thanks in advance
either of places you've suggested (application.js or specific coffeescript file) valid - though should written in coffee syntax if you're putting in coffeescript file.
you need put code within $(document).ready
function work...
$(document).ready(function() { $("p").hide(); $("a").click(function ( event ) { event.preventdefault(); $(this).hide(); }); });
Comments
Post a Comment