請是可能加載腳本標籤內的一些HTML元素表現出來,並使用類名怎樣把HTML腳本標籤中,並使用jquery
<script id="scripttags">
<div class="item-1">Hello</div>
<div class="item-2">Hello2</div>
<div class="item-3">Hello</div>
</script>
訪問它訪問的任何一個:
<script>
var loadit = $('script#scripttags item-2').clone();
alert(loadit);
<script>
請反正我可以這樣做嗎?
呃什麼......爲什麼?腳本是爲js - 不是html – ThisGuyHasTwoThumbs
你可以; t把html元素放在腳本標記中,而不是你可以動態地追加html如果你想要 –
@ThisGuyHasTwoThumbs是的我知道爲什麼我要加載我的html然後使用id或class來訪問它名字 –