jquery 批改button的click函数

WBOY
Release: 2016-06-13 10:52:00
Original
837 people have browsed it

jquery 修改button的click函数



点击修改button的click事件



这样我点击链接是就会触发按钮的click事件,我希望实现点击链接时修改按钮的click时间,当再点击确定时触发的是click2函数,该怎么实现?

------解决方案--------------------

PHP code
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script><input type="button" id="b" value="确定"><br><br><a href="javascript:;" onclick="change_click();return false;">点击修改button的click事件</a><script src="js/jquery.js" type="text/javascript"></script><script type="text/javascript">$(function(){    $("#b").bind('click',click1);});function change_click(){  $("#b").unbind('click');  $("#b").bind("click", click2);}function click1(){  alert(1);}function click2(){  alert(2);}</script><div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template