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

  • SEARCH
  • Home
  • 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 830077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:59:06+00:00 2026-05-15T03:59:06+00:00

I generate HTML using jQuery: $(<a />) .append(demo) .click(function () { DemoFunc(event, value.Id) })

  • 0

I generate HTML using jQuery:

$("<a />")
    .append("demo")
    .click(function () { DemoFunc(event, value.Id) })

This works perfect for Chrome and IE8, but in FireFox I got an error: “event is not defined”.
I changed the code like this:

.attr("onclick", "DemoFunc(event, " + value.Id + ")")

It works for Firefox, but not for Chrome and IE.

DemoFunc = function (e, assocGroupId) {
    var target = (e.target) ? $(e.target) : $(e.srcElement);
    ....
}

Why!? Help!!

  • 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-05-15T03:59:07+00:00Added an answer on May 15, 2026 at 3:59 am

    In IE and Chrome, event is resolving to window.event. Firefox doesn’t have this property and instead provides an event to an event handler function by passing it as a parameter. jQuery abstracts this difference for you by providing an event object parameter in all browsers:

    $("<a />")
        .append("demo")
        .click(function (evt) { DemoFunc(evt, value.Id) });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this jQuery function with jQuery UI to generate a datepicker when the
How can I generate this HTML using Jade <a class=btn btn-primary btn-large data-toggle=modal href=#websiteModal>
I'm using this dialog: http://docs.jquery.com/UI/Dialog To open dialog I do it this way: $('a.openModal').live(click,
I am creating an iframe using jQuery to a cross-site URL. This works properly
I'm using the jQuery template plugin to generate HTML from JSON data which the
I am using jQuery+AJAX to upload image and then generate html to show it.
I'm using jquery(mobile) to generate a select menu which hides/shows columns of an HTML
Context: HTML widgets generated using a Django ModelForm and template, jQuery 1.3.2, JavaScript on
ASP.NET MVC can generate HTML elements using HTML Helpers, for example @Html.ActionLink() , @Html.BeginForm()
I am trying to generate an HTML page using data gathered in a form

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.