Adding HTML Controls | JavaScriptSource

Adding HTML Controls

JavaScriptSource Staff Jul 13, 2005

General

Use this script to add HTML controls to your forms. This example uses the <input> tag.


Click below to dynamically create/remove input boxes in this field

Add more input field(s)
Remove field(s)

Notes

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: addHTMLControls.js


Head

Paste this code into the HEAD section of your HTML document.


Body

Paste this code into the BODY section of your HTML document


Leave a Response

(40 comments)

I was having a devil of a time trying to insert innerHTML into a span in IE. I found I could write some tags: b , a , img; but when I tried to write a div I would get the dreaded "unknown runtime error"[br /]I was going nuts trying to debug. I finally realized I had been doing the div insert just above on the same page with no problem and the difference was that I was writing to a div as opposed to a span. Simply changing the span container element to a div solved the problem!

Gordon Nov 28, 2008

That would really be a different type of script.

Lee Nov 6, 2008

That is all this script was created to do. You would need to either enhance this one or create a new one.

Lee Oct 31, 2008

Your question is beyond the scope of these comments. You will need to post it over on [a href="http://www.webdeveloper.com/forum/forumdisplay.php?f=3"]the JavaScript forum[/a]. Thanks!

Lee Oct 31, 2008

I am not sure from your code, but how would you add a label and then to the right of it a text box?

John Sutor Aug 4, 2008