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 8954635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:21:08+00:00 2026-06-15T14:21:08+00:00

I’m writing a script which prevents form clicking, but i can’t make it work

  • 0

I’m writing a script which prevents form clicking, but i can’t make it work in IE7 – 8, maby anyone know why it is?

I try to use ev = e || window.event; but nothing good happens.
Please help, and thanks in future.

(function( button ) {
    $( document ).click(function( e ) {
        ev = e || event;
        var clickedEl = ev.srcElement || ev.target;
        var parentClass = $( button ).attr( 'class' ).split(' ')[0];

        if ( clickedEl !== button && $( clickedEl ).parents( '.' + parentClass ).
length == 0 && !$( clickedEl ).hasClass( parentClass ) ) {

            // DO SOMETHING
        }
    });
})($('.category_select')[0]);
  • 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-15T14:21:09+00:00Added an answer on June 15, 2026 at 2:21 pm

    Because you’re using jQuery, an event object will be passed to the callback, regardless of the browser. Though it’s important to note that you won’t be receiving the “pure” event object: it’s wrapped in a jQuery object. To get the true event object, do this:

    var trueEvent = e.originalEvent;
    

    That should do the trick, mind you: you won’t have the jQuery stopPropagation method in IE8, you’ll have to correct for that manually by using .returnValue = false and .cancelBubble = true

    (function( button )
    {
        $( document ).click(function( e )
        {
                var ev = e.originalEvent,//this is all you need to do, plus ev is a variable, declare it as such, 
                clickedEl = ev.srcElement || ev.target,//separate var declarations by comma
                parentClass = $( button ).attr( 'class' ).split(' ')[0];
                if ( clickedEl !== button && $( clickedEl ).parents( '.' + parentClass ).length == 0 && !$( clickedEl ).hasClass( parentClass ) )
                {
                    // DO SOMETHING
                }
        });
    })($('.category_select')[0]);
    

    That should work
    I also had a look at the jQuery reference this is what it says on the jQuery event object

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how can I replace this 2 symbol below from the string
I have an autohotkey script which looks up a word in a bilingual dictionary
I have a text area in my form which accepts all possible characters from
I am writing an app for my school newspaper, which is run completely online
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
I have a small JavaScript validation script that validates inputs based on Regex. I

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.