Is something like...
<script type="text/html" id="this-content1">
<h1>This Header Info One</h1>
<p>This content one. . .</p>
</script>
<script type="text/html" id="this-content2">
<h1>This Header Info Two</h1>
<p>This content two. . .</p>
</script>
...and using jQuery to swap out the content based on a selector good practice in today's standards?
I am just getting into the use of script type="text/html"... to allow dynamic changes of my content and am finding many ways to do this. Is there a source that might explain the direction this is going and if any standardizing of this practice.
I see code like...
<div class="thumbnail">
<# if ( data.uploading ) { #>
<div class="media-progress-bar"><div></div></div>
<# } else if ( 'image' === data.type ) { #>
<img src="{{ data.size.url }}" draggable="false" />
<# } else { #>
<img src="{{ data.icon }}" class="icon" draggable="false" />
<# } #>
</div>
...nested in a script type="text/html" tag and really have no idea why it is written this way. Also have just wet my beak in backbone and this looks to be a little heavy if just looking to add content swapping in one page.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…