Instantiating Widgets: do the elements have to exist/be in body?
When instantiating a widget do I have to 'apply' it to an element already attached to the body element? Ie, like the following...
- var myWidget = $('#foo').MyWidget({option1: 'foo'})
- // Must add the element to the body to get it to function correctly (am I correct?)
- myWidget.appendTo($('body'));
Or can I just instantiate one like so...
- var myWidget = new MyWidget({option1: 'foo'});