隐藏/显示 jquery 在 IE 中不起作用

发布于 2024-09-15 07:02:10 字数 1119 浏览 3 评论 0原文

我有一个选择菜单,当单击选项时显示/隐藏“livetransopts”div。在 Firefox、Chrome 等中工作正常,但在 IE 中不行,任何人都可以帮助我吗???

  <select>
    <option class="hidelivetrans" value="No">No - Don't transfer the call</option>
                <option class="showlivetrans" value="Yes">Yes - Transfer the call</option>
              </select>
              </div>
              </div>
              <!--Live transfer yes/no field-->

              <script type="text/javascript">
              $(document).ready(function() {
                    $('.livetransopts').hide();

      $(".showlivetrans").click(function(){
                            $(".livetransopts").show('slow');           
                                        });
       $(".hidelivetrans").click(function(){
                            $(".livetransopts").hide('slow');           
                                        });
    });
              </script>

              <!--live trans opts-->
              <div class="livetransopts">
    <!--content here-->
    </div>

I have a select menu that shows/hides the "livetransopts" div when an option is clicked. Works fine in Firefox, Chrome etc but not in IE can anyone help me????

  <select>
    <option class="hidelivetrans" value="No">No - Don't transfer the call</option>
                <option class="showlivetrans" value="Yes">Yes - Transfer the call</option>
              </select>
              </div>
              </div>
              <!--Live transfer yes/no field-->

              <script type="text/javascript">
              $(document).ready(function() {
                    $('.livetransopts').hide();

      $(".showlivetrans").click(function(){
                            $(".livetransopts").show('slow');           
                                        });
       $(".hidelivetrans").click(function(){
                            $(".livetransopts").hide('slow');           
                                        });
    });
              </script>

              <!--live trans opts-->
              <div class="livetransopts">
    <!--content here-->
    </div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

¢蛋碎的人ぎ生 2024-09-22 07:02:30

正确的方法是将“更改”事件绑定到

$(function(){

  var myDiv = $(".livetransopts");


  $("select").change(function(){
    if (this.value=="Yes")
       myDiv.show('slow');
    else
        myDiv.hide('slow'); 
  });

});

The right way to do it would bind a "change" event to

$(function(){

  var myDiv = $(".livetransopts");


  $("select").change(function(){
    if (this.value=="Yes")
       myDiv.show('slow');
    else
        myDiv.hide('slow'); 
  });

});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文