小编Chr*_*ris的帖子

jquery每个输入hasClass

根据我的需要,我使用

$('#form :input').each( function(i) {
    if ( !$(this).hasClass('donot') ) {
        $(this).attr('disabled', 'disabled');
    }
});
Run Code Online (Sandbox Code Playgroud)

有没有更好的方法不使用if条件来检查输入是否有'donot'类?

谢谢你的帮助...

克里斯

each jquery input

8
推荐指数
1
解决办法
2万
查看次数

OWL Carousel afterMove获得img alt

如何在每次移动后显示(在div中)图像alt?我试试这个,但它不起作用(我总是第一个alt)

<div id="owlSlider" class="owl-carousel owl-theme">
      <div class="item"><img src="lg/img_1.jpg" alt="Image 1" class="img-responsive"></div>
      <div class="item"><img src="lg/img_2.jpg" alt="Image 2" class="img-responsive"></div>
      <div class="item"><img src="lg/img_3.jpg" alt="Image 3" class="img-responsive"></div>
</div>
<div><p id="legend" style="font-size:1.4em">&nbsp;</p></div>



$("#owlSlider").owlCarousel({
  navigation : false, 
  pagination: true,
  slideSpeed : 300,
  paginationSpeed : 400,
  singleItem:true,
  autoPlay:true,
  transitionStyle : 'fade',
  rewindNav: true,
  afterMove : function (elem) {
        var leg = elem.find('img').attr('alt');
        //console.log(elem);
        $('#legend').html(leg);
  }
});
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助...

javascript jquery carousel alt owl-carousel

2
推荐指数
1
解决办法
5955
查看次数

标签 统计

jquery ×2

alt ×1

carousel ×1

each ×1

input ×1

javascript ×1

owl-carousel ×1