0

Is there any reason the following code has no effect on font size?

<html>
<head>
    <title>test</title>
</head>
<body>
Test
    <script type="text/javascript">
        jQuery('body').css({fontSize:'2em'});
    </script>
</body>
</html>

Thanks

Edit: I for got the simple link. This is why I can't have nice things.

<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
1
  • Well, it's working. You may have not put jQuery there? Commented Jan 24, 2011 at 1:36

1 Answer 1

1

Yes, first try putting a proper DOCTYPE then add a link to jQuery, and finally try

<script type="text/javascript">
    $('body').css({'font-size','2em'});
</script>

==EXAMPLE==

<!DOCTYPE html>
<html>
<head>
    <title>test</title>
     <script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
Test
    <script type="text/javascript">
        $('body').css({'font-size','2em'});
    </script>
</body>
</html>
Sign up to request clarification or add additional context in comments.

1 Comment

@Micky, He doesn't have to, though I would.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.