function to create multiple objects

I have a page on which I want users to be able to create web objects on the same page with the push of a button. For example, to create a new draggable textfield object, a user would click on this button:

Below is the code for the function I came up with. However, it doesn't produce a new textfield. (Note the draggable class makes the object draggable - this part works if I create the textfield object manually).