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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:30:03+00:00 2026-05-20T15:30:03+00:00

For dynamically created elements I have noticed element.setAttribute(onClick,myFunction) doesn’t works properly in IE, whereas

  • 0

For dynamically created elements I have noticed element.setAttribute(onClick,myFunction) doesn’t works properly in IE, whereas element.onclick=myFunction works in all browsers. Are there any functional differences also apart from this browser difference?

  • 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-20T15:30:04+00:00Added an answer on May 20, 2026 at 3:30 pm

    In theory, setAttribute takes a string and assigns it to an attribute, this then gets mapped to any associated DOM properties. In IE 7 and lower (and in IE 8 in IE 7 compatibility mode and in Quirks mode), it assigns a value directly to a DOM property of the same name (rendering it case sensitive and useless when the property expects something other than a string value).

    The onfoo series of DOM properties take a function.

    It is generally preferred to use attachEventListener and friends instead, and to use an abstraction layer (such as provided by YUI, jQuery, etc) to assign the values. This is generally easier. Such libraries also tend to include features to work around memory leak related bugs.

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

Sidebar

Related Questions

I am trying to lookup elements within a dynamically created element. For some reason
I have these dynamically created file input HTML elements which are used with a
I have a number of DOM elements being dynamically created on a web page.
How do I add CSS to elements that have been dynamically created? Here is
I have some dynamically created elements that are supposed to be animated. The animations
I have an ASP.NET page that has dynamically created LinkButton elements. Please note that
I have a dynamically created array of integers. Now I have to remove all
Ok I have a dynamically created set of elements where each particular kind gets
I have a bunch of dynamically created elements in a page, with different 'onmouseover'
I have seen a few different methods for adding classes to dynamically created elements

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.