本文介绍了单击按钮时如何调用 javascript 函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
现在我正在使用:
<%=button_to_function "✓", checkButton(), :class => "buttonGrey"%>
但是 javascript 函数需要向它传递一些东西,以便它可以切换类(我希望在按下按钮时更改按钮类)我将传递什么作为参数来表示按钮?
But the javascript function needs something to be passed to it so it can toggle the class( I want the buttons class to be changed upon pressing it) What would I pass as a param to represent the button?
推荐答案
可以直接在button_to_function中执行javascript.
You can execute javascript directly in the button_to_function.
就你而言:
"buttonGrey" %>
希望这会有所帮助!
这篇关于单击按钮时如何调用 javascript 函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!