This page has moved. You will be automatically redirected to its new location in 10 seconds. If you aren't forwarded to the new page, click here.

Search This Blog

Monday, January 11, 2010

document.createElement not working on Firefox

document.createElement was working in all browsers other than FF.I changed this part

   1: var newElement = document.createElement("<input name='"+elementName+"' id='" + elementName + "' type='hidden'>");


to this:




   1: var newElement = document.createElement("input");



   2:  newElement.setAttribute('name',elementName);



   3:  newElement.setAttribute('id',elementName);



   4:  newElement.setAttribute('type','hidden');


and i got it working in all browsers


http://www.dustindiaz.com/add-and-remove-html-elements-dynamically-with-javascript/


http://www.eggheadcafe.com/community/aspnet/3/41127/firefox-createelement--a.aspx

1 comment: