新知識點

toggleClasscss

$("button").click(function(){
$("p").toggleClass("main");
});oop

each中的 falsethis

Use return false to break out of each() loops(循環) early.spa

$( "div" ).each(function( index, element ) {
// element == this
$( element ).css( "backgroundColor", "yellow" );
if ( $( this ).is( "#stop" ) ) {
$( "span" ).text( "Stopped at div index #" + index );
return false;
}
});
相關文章
相關標籤/搜索