Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder
    Join Date
    Sep 2011
    Thanked 27 Times in 27 Posts

    Function is not defined

    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:
    PHP Code:
    <button id="login-captcha-reload" class="btn btn-small btn-primary" onclick="reloadCaptcha()"><class="fa fa-refresh"></i></button
    Followed by this javascript later on:
    PHP Code:
    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!
    Last edited by Dubz; 05-16-2014 at 04:40 AM.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts