0

I am using simple captcha code in my contact form.

<div class="col-md-4" onload="Captcha();">
                                                <label>Enter Captcha *</label>
                                                <input type="text" value="" data-msg-required="Please enter captcha" maxlength="100" class="form-control" name="captcha" id="captcha" required>

                                    <img src="captcha.php" id="captacha-image">
<span onClick="
    document.getElementById('captacha-image').src='captcha.php?'+Math.random();
     id="change-image">Not readable? Change text.</span>


        </div>

The problem is while reloading the capcha image. the whole page reloads and page landing on top. The contact form is in the footer part of my page.

Nakshatra
  • 45
  • 1
  • 11

1 Answers1

0

You missed href value:

<a href="#" onClick="
    document.getElementById('captcha').src='captcha.php?'+Math.random();
    id="change-image">Not readable? Change text.</a>