我是靠谱客的博主 明亮向日葵,这篇文章主要介绍js通过button触发函数,现在分享给大家,希望可以做个参考。

web 通过button触发函数方法

方法一

通过 οnclick="return sim_select();" 实现button与return sim_select()函数绑定

//html
<input id="sim_switch_button" type="button" class="common-btn" onclick="return sim_select();"/>

方法二

通过$("#sim_switch_button")..on("click", sim_select); 实现id为sim_switch_button的button与return sim_select()函数绑定

attr("value", common_apply)此语句作用是在button上显示common_apply里面储存的值

//html
<input id="sim_switch_button" type="button" class="common-btn" />
//js
var common_apply = "应用";
$("#sim_switch_button").attr("value", common_apply).on("click", sim_select);

最后

以上就是明亮向日葵最近收集整理的关于js通过button触发函数的全部内容,更多相关js通过button触发函数内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(139)

评论列表共有 0 条评论

立即
投稿
返回
顶部