Is there an HTML element, or an element that, when combined with the correct CSS style properties, has no footprint except that it can be used as a container for other elements?
It would almost be like a “marker” on the page marker where actual HTML that does stuff should be placed by jQuery.
Example of what it might look like:
<span id='the_view_container' style='display:dont-do-anything'></span>
The reason I ask is because I’m working with Backbonejs and when I have to add a view to the screen, I find that I either have to specify the element that the view should be pegged to when creating the view, which has its drawbacks:
theView = new TheView({
el: $('#the-view-container')
});
Or I have to insert the view inside an existing element, usually a div. This creates difficulties with templating:
theView = new TheView({});
$('#the-view-container').html(theView.el);
$('#the-view-container').addClass('theViewClass'); // <-- Shouldn't have to do this
Any input is appreciated, thanks so much!
You would be better off dynamically creating an element.
However, you can create a ‘nothing’ element like this:
Then set the
stylewhen needed: