Changing text with onfocus in span

I’m learning javascript and working on a practice problem, but I’m having a hard time understanding what exactly it wants me to do.

The ask is:

Get the “pn” and “reminder” elements by their ids and assign them to the variables pn and rm, respectively. When pn receives focus, change the innerHTML of rm to the text “Format: 123-456-7890”. When pn is blurred, change the innerHTML of rm to an empty string (“”)

So my html is:

     <form>
        Phone Number:
        <input type="text" id="pn"> <span id="reminder"></span><br><br>
        Address:
        <textarea></textarea>
    </form>

The wording is so strange to me. So when the text box receives focus, the innerHTML should change? Does that mean I should be changing the "Phone Number"

If so, I think the javascript code would be (i think):

   var rm = document.getElementById('reminder');
   rm.innerText = span.textContent = 'Format: 123-456-7890';

I’m not sure how to make it change when I focus on the text box, but think I should be using onfocus, which would probably look something like:

  document.getElementById("pn").addEventListener("focus", myFunction);

  function myFunction() {
  document.getElementById("pn")....

But i’m not sure how to connect the two. Any suggestions?

I don’t really understand what the second part is asking: When pn is blurred, change the innerHTML of rm to an empty string (“”)

138 thoughts on “Changing text with onfocus in span”

  1. pharmacie bailly cabannes pharmacie grottes et beaulieu , pharmacie lafayette fleming pharmacie leclerc redon , [url=https://kit.co/leire/acheter-amantadine-100-mg-pas-cher-amantadine-a-vendre-en-ligne#]Acheter Amantadine 100 mg pas cher, Amantadine Г  vendre en ligne[/url] act therapy utah [url=https://kit.co/specex/bystolic-sans-ordonnance-suisse-bystolic-a-vendre-en-ligne#]Bystolic Nebivolol 5 mg[/url] , pharmacie auchan l’ilo pharmacie ramdani argenteuil , kerastase pharmacie lafayette. pharmacie aix en provence jas de bouffan therapie comportementale et cognitive bruxelles [url=https://kit.co/carddust/cozaar-pharmacie-france-cozaar-livraison-france#]Cozaar pharmacie France[/url] , pharmacie dupin bordeaux. pharmacie etampes, pharmacie en ligne belgique cialis pharmacie lafayette lievin . pharmacie pallanca beaulieu sur mer, pharmacie de garde aujourd’hui toulouse therapie cognitivo comportementale jura pharmacie intermarche nord beauvais .

    Reply
  2. Pingback: is ivermectin safe
  3. Pingback: stromectol dosage
  4. i need personal loan urgent, i need a loan my credit is bad. i need 2 lakhs loan need loan i own my home outright and need a loan i need loan to start the business, 1000 payday cash advance loans, cash advance, cash advances, cash advance payday loans bad credit ok. Bank lending to economics, designed for companies.

    Reply