Ich versuche href Wert mit jQuery zu erhalten:Wie erhält man mit jQuery Href-Wert?
<html>
<head>
<title>Jquery Test</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("a").click(function(event) {
alert("As you can see, the link no longer took you to jquery.com");
var href = $('a').attr('href');
alert(href);
event.preventDefault();
});
});
</script>
</head>
<body>
<a href="http://jquery.com/">jQuery</a>
</body>
</html>
Aber es funktioniert nicht. Warum?
Pflege, uns zu sagen, was genau nicht funktioniert? War der Alarm leer? Hast du sogar 2 Warnungen bekommen? Irgendwelche js Fehler? Es funktioniert für mich ... –
upss ..., sorry. Das Problem ist klar Cache –