zoukankan      html  css  js  c++  java
  • 关于jQuery表格行换色的三种方法

    $('tr').hover(function(event) {
          $(this)[ (event.type == 'mouseenter' ? 'add' : 'remove') + 'Class' ]('test');     //test是样式
    });
    
    $('tr').hover(function(event) {
          $(this).toggleClass('test');  //test是样式
    });
    
    $('tr').hover(function(){
         $(this).addClass('test');  //test是样式
    },function(){
         $(this).removeClass('test');  //test是样式
    });
    


    注:一般情况下使用第二种方法是可以的,但是遇到表格行可以拖拽的情况,那么就会出现BUG了,这个自行测试就知道了。
  • 相关阅读:
    CFgym102394I
    Infinite Fraction Path (后缀数组)
    2016ACM/ICPC亚洲区沈阳站-重现赛
    2sat学习笔记
    bzoj4176
    bzoj3309
    6C
    3U
    3T
    3R
  • 原文地址:https://www.cnblogs.com/edielei/p/2091244.html
Copyright © 2011-2022 走看看