Last active
January 30, 2023 13:15
-
-
Save motsu0/cab92cad833932ddc6f1ee1b12a33a92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 元のhtml --> | |
<div> | |
<div id="sample-parent">#sample-parent</div> | |
<div class="sample-parent">.sample-parent</div> | |
<div class="sample-parent">.sample-parent</div> | |
<div class="sample-parent">.sample-parent</div> | |
</div> | |
<!-- include処理 --> | |
<script src="pathto/include-html.js"></script> | |
<script> | |
includeHtml({ | |
name_target: '#sample-parent', | |
src_part: 'pathto/sample-part.html', | |
src_id: 'sample-div', | |
type_copy: 'outer', | |
src_js: ['pathto/sample-script.js'] | |
}); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 処理後のhtml --> | |
<div> | |
<div id="sample-parent"> | |
<div id="sample-div">書き換え後のテキスト</div> | |
</div> | |
<div class="sample-parent">.sample-parent</div> | |
<div class="sample-parent">.sample-parent</div> | |
<div class="sample-parent">.sample-parent</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.getElementById('sample-div').textContent = '書き換え後のテキスト'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment