$('tr').hover(function(event) {
$(this)[ (event.type == 'mouseenter' ? 'add' : 'remove') 'Class' ]('test'); //test is style
});
$('tr').hover(function(event) {
$(this).toggleClass('test'); //test is style
});
$( 'tr').hover(function(){
$(this).addClass('test'); //test is style
}, function(){
$(this).removeClass( 'test'); //test is style
});
Note: Under normal circumstances, it is okay to use the second method, but when encountering table rows that can be dragged, Then there will be a BUG, and you will know it through self-testing.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn