cannot set a name on hidden node in IE

I tried to create an hidden input node with dojo using dojo.create(‘input’, {type:’hidden’, name:’foo’, value:’bar’}).

It worked fine in FF, but when looking at IE7, created node always had no name.
After multiple attempts, the only workaround I found was to create an outer node and fill it with hidden node converted as string, using .innerHTML and then retrieve it back using .firstChild property of outer node.

Here is the example:

var dummy = dojo.create(‘div’, {innerHTML: ‘<input type=”hidden” name=”foo” value=”bar”/>’});
var myInput = dummy.firstChild;

By doing this, when myInput got inserted into DOM, it kept its name property.

Post a Comment

Your email is never published nor shared. You're allow to say what you want...