- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Can I wrap a JavaScript event in a jQuery event?
Yes, you can wrap a JavaScript event in a jQuery event. For wrapping, use the event object. You can try to run the following code to wrap a JavaScript event in a jQuery event −
Example
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $('a.one').click(function(event){ event.preventDefault(); }); function test(event){ $.Event(event).preventDefault(); } }); </script> <style type="text/css"> a.test { font-weight: bold; } body { font-family:sans-serif; } </style> </head> <body> <a class="one" href="https://tutorialspoint.com/">Tutorials</a><br/> <a class="two" href="https://qries.com/" onclick='test(event)'>QA</a> </body> </html>
Advertisements