KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have this code: <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> $(function(){ $('a.one').click(function(event){ event.preventDefault(); }); }); function test(event){ event.preventDefault(); } </script> <style type="text/css"> a.test { font-weight: bold; } body { font-family:sans-serif; background-color:#AAAAAA;} </style> </head> <body> <a class="one" href="http://jquery.com/">jQuery</a> <br/> <a class="two" href="http://stackoverflow.com/" onclick='test(event)'>stack overflow</a> </body> </html> The test-function does not work as it stands now, since a regular javascript event doesn't support the jQuery event preventDefault-function. Is there some way to wrap a regular javascript event in a jQuery event so that I can use e.g. preventDefault?
Tags (comma-separated)
Save Edits
Cancel