Feel like I hit a jackpot. Thanks!
On Aug 17, 1:11 am, "Erik Beeson" <[EMAIL PROTECTED]> wrote: > The jQuery function $() can parse HTML, as can the various DOM > functions (append, prepend, appendTo, etc): > > $('<input id="foo" type="text"/>').appendTo('#myForm'); > > --Erik > > On 8/16/07, Anurag <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > I am a jQuery beginner. I am working on an application for which I > > need to create DOM elements on the fly. Previously I was using > > document.createElement() and document.createTextNode() but that's not > > concise and looks odd along with jQuery code. > > > So I wrote a tiny 3 line plugin jquery.new.js. It's more of a hit and > > trial outcome. > > > jQuery.new = function(element) { > > return $(document.createElement(element)); > > } > > > I wrapped the new element that was created with the jQuery object so I > > can chain functions. For example: > > var inputBox = $.new("input").attr("type", "text").attr("id", > > "someText"); > > > Is there a better way to do this? Or does jQuery already have this > > functionality inbuilt?