解决方法
我认为这可以工作:
link_to "your link",href,:onclick => "jsFunction"
或者,做一切JS方面:
document.body.addEventListener('click',function(e) { var target = e.target || e.srcElement; if (target.tagName.toLowerCase() !== 'a') { return e;//not clicked on link } //a link was clicked,maybe check class or id or other stuff to narrow it down //if a link you were interested in was clicked: return theClickFunction.apply(target,[e]); },false);