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.
newbutton=document.createElement("Input");
newbutton.name="btnmsg";
newbutton.type="button";
newbutton.setAttribute("onClick","showmsg(this);");
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.
newbutton.onclick=function(){showmsg(this);}
Once after making the above change the code is working fine in both IE and FireFox.
More Articles...
No comments:
Post a Comment