Unobtrusive javascript with jquery - good 10 minute tutorial?

后端 未结 1 383
悲哀的现实
悲哀的现实 2020-12-30 06:07

I\'m looking for a good 10 minute introduction to Unobtrusive Javascript using JQuery. I\'m completely new to the concept, and I\'d like to see how the event binding and su

相关标签:
1条回答
  • 2020-12-30 06:30

    I guess the Tutorials page on jQuery homepage would be a good place to start :)

    Simple example to remove a link you 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 only when DOM has finished loading
        $(document).ready(function() {
            $('#removeme').click(function() {
                // remove element that has been target of the event
                $(this).remove();
                // stop browser from following the link
                return false;
            });
        });
    </script>
    </head>
    
    <body>
      <p>
        <a id="removeme" href="http://example.org">Remove me</a>
      </p>
    </body>
    </html>
    
    0 讨论(0)
提交回复
热议问题