Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8895215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:43:09+00:00 2026-06-14T23:43:09+00:00

I set up an anchor tag using javascript so that that onclick , I

  • 0

I set up an anchor tag using javascript so that that onclick, I call a function showSavingsEasterEgg and pass it a value. The problem I am getting is that I’m not referencing my function correctly:

ReferenceError: showSavingsEasterEgg is not defined

I’ve tried moving the showSavingsEasterEgg function into the showData function to see if it solved the scoping problem, but it didn’t.

Any tips

define(["jquery", "go/util", "underscore", "jqueryui/slider"], function ($, util,_) {

  function showData(data) {
    $('#item').append('<a class="savings_link" href="#" onclick=\'showSavingsEasterEgg('+data[key]['saving']+')\'> Savings');
  }

  function showSavingsEasterEgg(data){
    console.log("SUccess");
    console.log(data);
  }

});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:43:11+00:00Added an answer on June 14, 2026 at 11:43 pm

    Put the definition of showSavingsEasterEgg directly in the global scope.

    Here, it can’t be found.

    You can do this :

    window.showSavingsEasterEgg = function (data){
        console.log("SUccess");
        console.log(data);
    };
    define(["jquery", "go/util", "underscore", "jqueryui/slider"], function ($, util,_) {
      function showData(data) {
        $('#item').append('<a class="savings_link" href="#" onclick=\'showSavingsEasterEgg('+data[key]['saving']+')\'> Savings');
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The problem for me is pretty straight forward. Onclick of an anchor tag ,
I'm using this code: <script type='text/javascript'> $(document).ready(function () { //Check if url hash value
How do I set the text of an anchor tag in javascript? This does
When an anchor tag is clicked, anotherDiv is made visible. Using jQuery, I want
I tried to set anchor tag mailto attribute like <a href='mailto:info@company.com'>info@company.com</a> in webview. when
I want to set a anchor tag in a provided string. It search in
I am calling a function test() on an anchor tag like this:- <a class=link
All Images are 320px. The width of their container (a anchor tag) is set
If I create an HTML anchor tag and set the disabled attribute to true,
In ASP.NET MVC, I'm trying to create a link that includes an anchor tag

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.