Tuesday, June 9, 2009

Resolved IE specific issue related to calling function at onclick event using createElement

I have explained about inconsistent behavior of createElement function in IE and mentioned workaround also in my previous post.

Today, we faced similar issue with createElement. This issue is also again related to IE.

Find below the sample code which will create a new button. A function "showmsg" should be called on clicking the new button.


The above code worked fine in FireFox. But it didn't work in IE.

Once after searching the internet we found below workaround for resolving this issue.

Instead of using setAttribute for onclick event, we used below code.


Once after making the above change the code is working fine in both IE and FireFox.

More Articles...

No comments:

Search This Blog