Skip to content

JavaScript linking with HTML

المعرفة:: JavaScript
الحالة:: ملاحظة_مؤرشفة
المراجع:: JavaScript Essential Training


Where to put JavaScript code?

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script

Inline: in an HTML document

<script>  
  const allCode = document.querySelectorAll("code");  

  for (let item of allCode) {  
    item.innerHTML = `&lt;${item.innerHTML}&gt;`;  
  }  
</script>  

External file

<script src="script.js"></script>  

Last update : August 14, 2023
Created : August 23, 2022

Comments

Comments