Unobtrusive javascript with jquery - good 10 minute tutorial? -
i'm looking 10 minute introduction unobtrusive javascript using jquery. i'm new concept, , i'd see how event binding , such works.
as background, i'm looking "remove tag" system similar have here on so. looking @ source, didn't see js, img tag. makes me think there must external js that's binding click event. want know how that, , want tutorial shows me how!
i guess tutorials page on jquery homepage place start :)
simple example remove link have clicked on follows:
<html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script type="text/javascript"> // execute script when dom has finished loading $(document).ready(function() { $('#removeme').click(function() { // remove element has been target of event $(this).remove(); // stop browser following link return false; }); }); </script> </head> <body> <p> <a id="removeme" href="http://example.org">remove me</a> </p> </body> </html>
Comments
Post a Comment