1
我試圖在Rails中使用jQuery。我開始有問題了。我需要附加一個jQuery函數。假設,我有這樣的link_to助手
<%= link_to "Sign in", :id => "user_sign_in" %>
基本的jQuery和Rails
我需要當用戶點擊此鏈接顯示的彈出窗口。我在我的application.js文件中寫什麼?這是我到目前爲止,但它不工作: jQuery(function(){ $("#user_sign_in").live("click", function(){ alert('I'm hit') }) };)
請建議!
閱讀本... http://stackoverflow.com/questions/5208412/rails-3-how-to-use-the-link-to-helper-to-open-a-popup – 2011-03-13 15:58:10
這是明顯的Javascript,我的目的是學習如何在Rails中使用jQuery。謝謝。 – rookieRailer 2011-03-13 16:00:33
你是否下載jQuery的rails.js? https://github.com/indirect/jquery-rails鏈接在底部 – 2011-03-13 16:01:55