如何将 <script> 标签放在 <div> 标签中?

演示开发人员

我是 HTML 和 JavaScript 的初学者。我想在<script>标签内放置<div>标签。我想在里面显示甜蜜的警报标签

感谢您的提前。

<div id="content">
  <script type="text/javascript">
      function myFunction() {
        console.log("problem with student");
        swal("You entered the regno more than once", " Your team is not registered yet! Register Again",         "error");
        }
     myFunction();
   </script>
</div>

慧萨摩

当您是初学者时,您应该通过 CDN 包含该库(https://sweetalert.js.org/guides/#installation)。也许您可以使用 Webpack 并通过 NPM 安装包。

这是我对您的代码的提示:

<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

<div id="content">
  <script type="text/javascript">
      function myFunction() {
        	console.log("problem with student");
        	swal("You entered the regno more than once", " Your team is not registered yet! Register Again",         "error");
      }
      myFunction();
   </script>
</div>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章