CreateTime--2016年12月8日15:28:40
Author:Marydon
js&jquery规避报错信息的两种方式

<script type="text/javascript">
    $(function() {
        /*方法一:捕获异常*/
        try {
            $('div[id=TreeContainer]').each(function(){
                    $(this).width($('#LeftPage').width());
            });
        } catch (e) {}
        /*方法二:加上非空校验*/
        if ($('div[id=TreeContainer]')) {
            $('div[id=TreeContainer]').each(function(){
                $(this).width($('#LeftPage').width());
            });
        }
    });
</script>

 

 

相关文章:

  • 2021-07-17
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
  • 2022-02-15
  • 2021-06-14
猜你喜欢
  • 2021-07-20
  • 2021-06-01
  • 2021-12-24
  • 2022-12-23
  • 2021-09-29
相关资源
相似解决方案