Я намагаюся отримати значення href за допомогою jQuery:
<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>
Але це не працює. Чому?
Хочете сказати нам, що саме не працювало? чи було сповіщення порожнім? Ви навіть отримали 2 попередження? Будь-які js помилки? Це працює для мене ...
—
Бен Роу
upss ..., вибач. проблема - кеш ясний
—
Аді Сембінг