My simple script won't work
This simple script wont work. It's supposed to simply select an element and alert to how many are selected. I can't see why such a simple script is not working....it keeps saying 0.
js code:
- $(document).ready(function() {alert($('p A:link').length + ' elements');});
html code:
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Untitled Document</title>
- <link rel ="Stylesheet" href="styles/mycss.css" type="text/css"/>
- </head>
- <body>
- <script type="text/javascript" src="scripts/jquery-1.4.2.js"></script>
- <script type="text/javascript" src="scripts/myjs.js"></script>
- <p>
- <a href="http://google.com"> The compound style here </a> </p>
- <p id = "yeah">
- <a href="http://google.com"> The compound style here2 </a> </p>
- </body>
- </html>
css:
- @charset "utf-8";
- /* CSS Document */
- .one {
- font-size: 16px;
- font-style: italic;
- color: #0C9;
- }
- p A:link {
- font-size: 36px;
- color: #F00;
- text-decoration:none;
- }