jquery onclick function not firing with rails link_to_remote

Posted by RahTha on Stack Overflow See other posts from Stack Overflow or by RahTha
Published on 2010-04-30T06:10:21Z Indexed on 2010/04/30 6:17 UTC
Read the original article Hit count: 277

In the js file of the page, inside $(document).ready(function() {} i have

$(".school a").live("click", function (e){ e.preventDefault(); ....; jsFunc(param1, param2, param3); });

Now the div with the class school has tags generated by rails link_to_remote with :url, :action, :before, :html.

On clicking on this link it does all that it should do with regards to link_to_remote, but somehow the onclick event in the document.ready does not attach to it. Why would this be happening? The jsFunc all it does is post to a url async-ly, i figured out that stuffing that post url in the :before of the link_to_remote would work - but is there a more elegant way of just being able to use the attach functionality

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ruby-on-rails