/ タブ内の/ <script>タグ - html

タブ内の<script>タグ - html

私はタブとしていくつかのhtmlを注入していて、私が注入しているhtmlの中に、またはメインのhtmlの中に、関連するスクリプトタグを入れる必要があるのだろうと思っていました。

例えば

<html>
<head>
<!-- would my tab specific script go here?-->
</head>

<!--html being injected as a tab-->
<div>
<!--got from an external html file-->
<html>
<head>
<!-- or here?-->
</head>
</hmtl>
</div>
</html>

回答:

回答№1の場合は-1

小さなスクリプトであればメイン文書に入れてしまいますが、メイン文書の後にJSをロードする必要がある場合は、jQuery.getScript()を試してみてください。

http://api.jquery.com/jQuery.getScript/