Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"
- type="text/javascript"></script>
- <script type="text/javascript">
- $(function() { // in jQuery, $() appends an onLoad handler to document
- $('#myAlert').click(function () { // adds an onClick handler to #myAlert
- alert(this.getAttribute('data-message')); return false;
- })
- // we could add other elements' event handlers here
- });
- </script>
- </head>
- <body>
- <p><a href="#" id="myAlert" data-message="Hello from UJS">Click Here</a></p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement