View Full Version : Function is not defined

May 16th, 2014, 03:22 AM
I am trying to create an onclick event for a button to call a function, however it's stating that the function is not defined. I'm trying to duplicate a captcha image to use it in two separate forums but I need the buttons for it (refresh, audio/image version) to update both of them, not just one. I've gotten those to work in one forum, but I need the second forum to control the first and reCaptcha doesn't work like that, so I'm making my own functions to call theirs and then copy it over.

What I did was change the refresh button to this:

<button id="login-captcha-reload" class="btn btn-small btn-primary" onclick="reloadCaptcha()"><i class="fa fa-refresh"></i></button>

Followed by this javascript later on:

function reloadCaptcha() {

*I know it's not php but it highlights the code to make it easier to read

If you need the link I'll send it in a PM, I don't want to post it publicly.

Error outputted by firebug:

ReferenceError: reloadCaptcha is not defined

The function is actually wrapped in a jquery function, but I use another function inside it, I guess I could try moving it outside of it and recall jquery in it? I'll give it a shot for the time being.

This seems to work for me, never mind then!