From: HugeBob on 10 Jun 2010 14:45 Hi All, I'm trying to dynamically create a checkbox. Here's my code: 1. checkBox = document.createElement("input"); 2. checkBox.setAttribute("type", "checkbox"); 3. checkBox.name = "someBox"; This works fine in Firefox of course. But, IE balks on line 2 saying it can't find a "type" attribute. Any clues as to what I'm doing wrong?
From: Thomas 'PointedEars' Lahn on 10 Jun 2010 14:57 HugeBob wrote: > I'm trying to dynamically create a checkbox. Here's my code: > > 1. checkBox = document.createElement("input"); > 2. checkBox.setAttribute("type", "checkbox"); > 3. checkBox.name = "someBox"; > > This works fine in Firefox of course. But, IE balks on line 2 saying > it can't find a "type" attribute. Any clues as to what I'm doing > wrong? You are not telling the actual error message, IE and OS version, you may have not declared `checkBox', and you are using setAttribute("type", ...) when you should have used .type = ... Bottom line: You did not read the FAQ before posting. <http://jibbering.com/faq/#posting> PointedEars -- Anyone who slaps a 'this page is best viewed with Browser X' label on a Web page appears to be yearning for the bad old days, before the Web, when you had very little chance of reading a document written on another computer, another word processor, or another network. -- Tim Berners-Lee
From: Laser Lips on 11 Jun 2010 11:48 Just do this... var checkBox = document.createElement("input"); checkBox.type="checkbox"; checkBox.name = "someBox"; Simples...*CHUK* Graham > 1. checkBox = document.createElement("input"); > 2. checkBox.setAttribute("type", "checkbox"); > 3. checkBox.name = "someBox"; >
|
Pages: 1 Prev: Regular expression for this? Next: JSON name/value name as number |