Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing CSS attribute with JQuery

Today I was shown a really simple way to change the font-size of an element using jQuery. It looked very similar to the following:

<script  type="text/javascript">
    jQuery(document.body) ({font-size:5em;});
</script>

This obviously doesn't work, but I was wondering what's missing? I remember it being just one line of code.

Note: I have tried jQuery(document.body).css({font-size:5em;}); as well, without success.

Thanks.

like image 554
Hanna Avatar asked Jan 27 '26 01:01

Hanna


1 Answers

jQuery('body').css({fontSize:'5em'});
like image 96
Dogbert Avatar answered Jan 28 '26 18:01

Dogbert