Home HTML Data Types DOM JavaScript JS Debugging Review Ticket

Hacks

  • Copy your HTML code from the HTML hacks. Write a Javascript snippet to switch the links of the two a tags when a button is pressed. Once they are switched, change the inner HTML of the top p tag to the word “switched!”
%%html
<!-- html code goes here (make sure to run) -->

<div>
  <t>About Myself</t>
  <p id="intro">Hi I'm Saathvik Gampa, an aspiring computer science developer! I am 15 years old and go to Del Norte High. I am currently in my Sophomore year in high school challenging myself with 3 AP courses. Here are more facts about me:</p>
  <strong>Here is my GitHub if you want to see what I'm working on so far!</strong>
  <a id="githubLink" href="https://github.com/sgtech08">
      <button>GitHub</button>
  </a>
  <button onclick="switchLinks()">Switch Links</button>
</div>
<br>
<br>
<div>
  <h3>Here are my passions</h3>
  <a id="cryptoLink" href="https://www.google.com/search?q=crypto+p&sourceid=chrome&ie=UTF-8"> Trading Crypto</a>
  <h3>Here is my Instagram</h3>
  <a id="instaLink" href="https://www.instagram.com/saathvikg08/">Instagram</a>
  <p id="passionDescription">Right now my idea of my passion project is going to be a crypto niche with some sneakers and watches incorporated. If I can learn how, I would like to do a website where you can place orders with crypto and it validates the transaction. Later I get the notification that an order has arrived to purchase their items from my supplier and ship it out to them.</p>
</div>

<script>
  function switchLinks() {
      // Get the anchor elements
      let cryptoLink = document.getElementById("cryptoLink");
      let instaLink = document.getElementById("instaLink");
      
      // Swap their href attributes
      let temp = cryptoLink.href;
      cryptoLink.href = instaLink.href;
      instaLink.href = temp;
      
      // Change the inner HTML of the top p tag
      document.getElementById("intro").innerHTML = "Switched!";
  }
</script>

About Myself

Hi I'm Saathvik Gampa, an aspiring computer science developer! I am 15 years old and go to Del Norte High. I am currently in my Sophomore year in high school challenging myself with 3 AP courses. Here are more facts about me:

Here is my GitHub if you want to see what I'm working on so far!



Here are my passions

Trading Crypto

Here is my Instagram

Instagram

Right now my idea of my passion project is going to be a crypto niche with some sneakers and watches incorporated. If I can learn how, I would like to do a website where you can place orders with crypto and it validates the transaction. Later I get the notification that an order has arrived to purchase their items from my supplier and ship it out to them.