how to print javascript variable in html tag?

Today, We want to share with you print javascript variable in html.In this post we will show you how to display javascript variable value in html table?, hear for display javascript variable in html div we will give you demo and example for implement.In this post, we will learn about
How to display javascript variable in html?
with an example.

Read Also:  how to print javascript variable value in html page?

how to display a javascript var in html body?

Example 1: index.html


    function getOnlineData() {
      var registeration_number = "98256";
      document.getElementById("exampleData").innerHTML = registeration_number;

<body onload="getOnlineData()">

  <h1>"The value for registeration number is: " <span id="exampleData"></span></h1>



Example 2: Use document.write()

  <script type="text/javascript">
    var registeration_number = 98256;

      the value for registeration number is:
      <script type="text/javascript">

I hope you get an idea about how to display jquery variable value in html page.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Read Also:  PHP Laravel Inline CRUD Using jQuery and AJAX

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  jQuery Ajax Autocomplete Search From Database in Laravel 7
  2. Read Also:  How to print to console using javascript?
  3. Read Also:  Select / Deselect all checkboxes using jQuery
  4. Read Also:  How to print/display javascript variable in html?
  5. Read Also:  Bootstrap Autocomplete Search Box / textbox in PHP MySQL
  6. Read Also:  Laravel Ajax Bootstrap Toggle switch Update MySQL
  7. Read Also:  How to Create a Currency Converter using Pipe with Angularjs?
  8. Read Also:  Bootstrap change tooltip content on click jQuery
  9. Read Also:  javascript Manage cookies setcookie and getcookie
  10. Read Also:  javascript redirect to relative url with parameters