Skip to main content
GameDev.net gamedev.net
🔒 Locked

[web] This jquery code won't work? Strange.

Started by Fl4sh Jul 30, 2010 at 5:40 PM 2 replies 900+ views
Original Post
Fl4sh
Fl4sh
html:
<!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><h3> The compound style here  </h3><h3> The compound style here2  </h3></body></html>


css:
@charset "utf-8";/* CSS Document */.one {	font-size: 16px;	font-style: italic;	color: #0C9;}h3 A:link {	font-size: 36px;	color: #F00;	text-decoration:none;}


jquery:
// JavaScript Document$(document).ready(function() {alert($('h3 A:link').length + 'elements');});


It's supposed to popup an alert saying that two links are selected. But it always says 0.
They hated on Jeezus, so you think I give a f***?!
leiavoia
leiavoia
Assuming Firefox:

Install FireBug

Use console.dir( object ) to get a full report of what's in the object.

Firebug will also let you know if you made any obvious mistakes like not even linking to the file correctly.

Additionally, I'm not familiar with "A:link" syntax. Just use "A".
dmatter
dmatter
I guess that "a:link" might be selecting just unvisited links, so if you've visited google.com then that might be why you get zero results back. Alternatively it might just not be a correct psuedoclass for a jquery selector (I've never tried it though).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.