0

Hi I am trying to create a jquery.terminal. I tried to follow this article, here it uses the body tag, I wish to use only a div for the terminal area not the whole body. Tried accessing the <div id="myterm"></div> like

<script>
  $('#myterm').terminal({
    hello: function (name) {
      this.echo('Hello, ' + name + '. Welcome to MyTerm');
    }
  },
  {
    greetings: 'Checkout help !'
  });
</script>

But didn't work !

Creator54
  • 171
  • 9
  • Do you get an error in the console about #myterm being an invalid selector? If so then you need to define your div before the script. Or use `$(function() { });` there is a note in the article. – jcubic Aug 07 '22 at 13:00
  • @jcubic the issue was regarding the cdn's sometimes the js files failed to get downloaded, idk maybe my internet issue or the cdn's delivery system. After I locally downloaded and changed the refrence's to the local one's it started working perfectly. – Creator54 Aug 07 '22 at 19:27

1 Answers1

0

Yes it does work. Try hello world on the prompt

$('#myterm').terminal({
    hello: function (name) {
      this.echo('Hello, ' + name + '. Welcome to MyTerm');
    }
  },
  {
    greetings: 'Checkout help !'
  });
#myterm {
  height: 300px;
  border: 1pxs solid red;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/2.34.0/js/jquery.terminal.min.js" integrity="sha512-lfkU/Qku0yOVZEYANlw2mOv7fpHFdS1E62UT7vJ55k22OB+xgRNNa6Cdor4Lugl4jhDjX29lJAG12X/OHFe8JQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/2.34.0/css/jquery.terminal.css" integrity="sha512-lT1/Sb6Bu4LaJJoTsxNZnlvt7pjuntBoSqSMJY7MxG5Yl1XgxsXA6jcJinPU0lx5eEsnudBE1ubzHSYR/W8xTw==" crossorigin="anonymous" referrerpolicy="no-referrer" />

<div id="myterm"></div>
IT goldman
  • 14,885
  • 2
  • 14
  • 28