doufeixi6014 2016-02-02 08:21
浏览 161
已采纳

点击无法运行js功能

i have try everething but i can't change button text by choosing some item in "Requirements" dropdown. Here is the site.

At the bottom of the page there is "Requirements" dropdown. For each item i have onclick:

<li class="select2-results-dept-0 select2-result select2-result-selectable select2-highlighted" onclick="qwerty()" role="presentation">

And I have JS code:

function qwerty() {
    if(jQuery('#role').val() != 'seeking-to-acquire-a-business') {
        jQuery("#ze-next").attr('value', 'Register');
    } else {
        jQuery("#ze-next").attr('value', 'Next');
    }
}

but text button still not changing when i choose "seeking to acquire a business" . Please tell me what i am doing wrong.

  • 写回答

6条回答 默认 最新

  • dshdsh2016 2016-02-02 08:37
    关注

    onclick not called when changing the value of #role.

    use change event instead :

    jQuery('#role').on('change',function(){
        qwerty();
    });
    

    or add onchange attribute in you #role element :

    <select id="role" onchange="qwerty()" ...... >
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答