Click here to Skip to main content
15,898,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When i click on Buy Now button the next page appears but it is not showing the contents which want it to show. What is wrong with this code?

This is HTML code:
HTML
<div class="card-body" style="height: 260px">
      <p class="card-text"> Java is a general-purpose programming language that is class-based, object-oriented, and designed to have as few implementation dependencies as possible</p>
    </div>
    <div class="card-footer" style="height: 56px">
      <center><a href="BuyCourse.html">Buy Now</a></center>
    </div>


This is second page code which opens after clicking on Buy Now
HTML
<div class="container" id="containerJava">
        <div>
          <div>
            Course Name :-
            <p id="lblcourse"></p>
          </div>

          <div>
            Course Duration :-
            <p id="lblduration"></p>
          </div>

          <div>
            Course Price :-
            <p id="lblprice"></p>
          </div>

And this is the JavaScript code

function BuyJava() {
    document.getElementById("lblcourse").innerHTML = "Java";
    document.getElementById("lblduration").innerHTML = "6 Months";
    document.getElementById("lblprice").innerHTML = "6000/-";
}


What I have tried:

Can you please Provide me the solution?
Posted
Updated 22-Dec-19 22:17pm
v2

1 solution

Your code to update the elements with text are defined within a function BuyJava, but are you sure this function is being called from somewhere when the page loads?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900