0

When I insert this in Wordpress rawhtml code I'm having this error in page view can you help me why I'm having this error? Uncaught ReferenceError: myfunction is not defined at HTMLInputElement.onclick

Here's the snippet of the code:

function myfunction(id)
{
  if(id>4)
    {
      document.getElementById('msg2').style.display="block";
      document.getElementById('msg1').style.display="none";
      document.getElementById('url2').style.display="block";
      document.getElementById('url1').style.display="none";
    }
   else
    {
      document.getElementById('msg2').style.display="none";
      document.getElementById('msg1').style.display="block";
      document.getElementById('url1').style.display="block";
      document.getElementById('url2').style.display="none";
    }
}
<div class="cont">

<div class="stars">

  <form action="">
  <input class="star star-5" id="star-5" type="radio" name="star" onclick="return myfunction(5)"/>
  <label class="star star-5" for="star-5"></label>
  <input class="star star-4" id="star-4" type="radio" name="star" onclick="myfunction(4)"/>
  <label class="star star-4" for="star-4"></label>
  <input class="star star-3" id="star-3" type="radio" name="star" onclick="myfunction(3)"/>
  <label class="star star-3" for="star-3"></label>
  <input class="star star-2" id="star-2" type="radio" name="star" onclick="myfunction(2)"/>
  <label class="star star-2" for="star-2"></label>
  <input class="star star-1" id="star-1" type="radio" name="star" onclick="myfunction(1)"/>
  <label class="star star-1" for="star-1"></label>
</form>
</div>
  <br>
  <br>
  <h3 id="msg1" style="display:none;">Give us a feedback</h3>
  <h3 id="msg2" style="display:none;">Thank you! We'd be grateful if you could give us a short review</h3>
  <br>
  <a class="click_here" id="url1" href="#" style="display:none;">SUBMIT</a>
  <a class="click_here" id="url2" href="#" style="display:none;">SUBMIT</a>
</div>

0 Answers0