मैं jQuery का उपयोग कर href मूल्य प्राप्त करने की कोशिश कर रहा हूँ:jQuery का उपयोग करके href मान कैसे प्राप्त करें?
<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>
लेकिन यह काम नहीं करता। क्यूं कर?
हमें बताने के लिए वास्तव में काम नहीं किया क्या केयर द्वारा href मूल्य प्राप्त करने के लिए? अलर्ट खाली था? क्या आपको 2 अलर्ट भी मिले? कोई जेएस त्रुटियां? यह मेरे लिए काम कर रहा है ... –
upss ..., क्षमा करें। समस्या स्पष्ट कैश है –