-

xiyueta().toggle() 属性方法

显示或隐藏匹配的元素。
快速上手

xiyueta().toggle()属性方法,一种调用方式:
1、xiyueta("li").toggle(); //显示或隐藏匹配的元素。

总结:xiyueta().toggle()用法与jQuery中jQuery().toggle()用法保持一致。
xiyueta().toggle(function(i){})可以向jQuery里一样来使用
see https://api.jquery.com/toggle
尝试一下>>

  • 代码
  • 效果
<script src="https://www.xiyueta.com/js/xiyueta.min.js"></script>
<script>var html='<hr style=""> <hr style="display: none;color:red;"> ';
$.load(html); 
$("hr:eq(0)").hide().attr("style")
$("hr:eq(1)").show().attr("style")

$.log(xiyueta.html())
</script>
<hr style="display: none;"> <hr style="color: red;">