Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8640929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:23:51+00:00 2026-06-12T11:23:51+00:00

I am learning jQuery and am looking to clarify what e.preventDefault() does. From what

  • 0

I am learning jQuery and am looking to clarify what e.preventDefault() does. From what I have read it prevents the default behaviour of the event.

An example in my case would be that I have an anchor tag which rather than take me to a new page I want it to display a modal on my screen. So my jQuery looks like this

$(document).ready(function() {
$('#boxShow').click(function(e) {
    e.preventDefault();
    $("#light").fadeIn();
    $('#fade').fadeIn();
});

Is the preventDefault() enabling me to perform a different event?

Apologies if this is a stupid question

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:23:52+00:00Added an answer on June 12, 2026 at 11:23 am

    It’s easy, it prevents the default event from happening. For example an <a> element normally opens a link on click. In order to override that you will need to use this function.

    This is easier to read once you use event instead of the acronym e.

    $('a').click(function(event){
        event.preventDefault();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm in the process of learning JQuery, and I'm looking to have a list
I'm looking for an example of how I would read a value from a
I've recently been learning jQuery Mobile but have a hard time remembering all the
Hi I am learning JQuery and I have written a small function where I
I'm learning JQuery and have found the factory function $() with its selectors quite
I am learning JQuery, and I have ran into an odd issue. I made
I have just started learning Jquery and am new to writing javascript (I am
I'm learning jQuery-UI, and would like to put together a good looking page, so
I'm learning jQuery and have a question on how to hide the submit button
I'm just learning jQuery, I'm so noob. see, we have 2 divs as follows:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.