setAttribute not working for onclick in IE

August 8, 2008

You can’t use javascript setAttribute() to set an onclick event on a link in Internet Explorer, I’ve discovered. You have to use <element>.onclick = <something> instead.

See  here http://justinfrench.com/index.php?id=25 and here http://www.quirksmode.org/js/events_tradmod.html

Advertisements

3 Responses to “setAttribute not working for onclick in IE”

  1. idleboy Says:

    thanks mateeeeeee

  2. trevor Says:

    events are only a few of the attributes IE can’t set properly.

    See this bug report for details on all of them.

    http://webbugtrack.blogspot.com/2007/08/bug-242-setattribute-doesnt-always-work.html


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: