Created
August 2, 2011 12:12
-
-
Save craigmartin/1120069 to your computer and use it in GitHub Desktop.
solution to question #6 - pre-plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style>p { background:yellow; margin:6px 0; } p.off { background: black; }</style> | |
<script src="http://code.jquery.com/jquery-latest.js"></script> | |
</head> | |
<body> | |
<p>Hello!</p> | |
Good to see you. | |
<p>Want to try some links?</p><br><br> | |
<div id="links"> | |
<p><a href="http://google.com" onclick="validateLink()" style="font-weight:normal;">Try using Google as a search engine? Just got back from your trip to Neptune? ... I understand.</a></p><br> | |
<p><a href="http://www.uab.edu/news/latest/item/1039-deep-space-travel-could-create-heart-woes-for-astronauts" onclick="validateLink()" style="font-weight:normal;">It might affect more than your brain too ..</a></p><br> | |
<p><a href="http://www.bloomspot.com/chicago/astro-palace-hotel-suites/" onclick="validateLink()" style="font-weight:normal;">And then you can rest here, great for space travelers.</a></p><br> | |
</div> | |
<button id="disableLink">Disable links</button> | |
<script> | |
validateLink = function () { | |
}; | |
$('a').each(function(index, value){ | |
console.log($('a').attr('href')); | |
}); | |
//outputs: every links href element on your web page | |
$("#disableLink").click(function(){ | |
$("a[href]").click(function(e){ | |
e.preventDefault(); | |
var href = $.data(this, 'href'); | |
// console.log(href); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment