After reading jQuery’s CSS documentation, it doesn’t look like it offers any advantages over just getting the Javascript element directly and manipulating its CSS by updating the property. Am I missing something?
After reading jQuery’s CSS documentation , it doesn’t look like it offers any advantages
Share
You should use the jQuery
cssmethod, it provides many benefits:.csscall..css('opacity', 0.8)without having to test if the user is using IE and applying ugly alpha workarounds.$('#foo').css('prop', 'value')more organized and readable than$('#foo')[0].style.prop = 'value';Let alone
.cssprovides other jQuery’s functionalities, such as chaining methods and automatically iterating through element arrays.